jseerden/IntuneBackupAndRestore

Compare-IntuneBackupDirectories handling for new (added) files in DifferenceDirectory

Closed this issue · 2 comments

Comparing two full backup directories while the more recent one has some items added (for example a new Intune Configuration profile has been created since the last backup) does not provide any output for the user. This may mislead user to believe nothing has changed.

Reproduction steps:

  1. Create full backup via Start-IntuneBackup (this will be the ReferenceDirectory)
  2. Make a change in Intune which would reflect as an added (new) JSON file in the next backup (create a new device configuration profile for example)
  3. Create another full backup via Start-IntuneBackup (this will be the DifferenceDirectory)
  4. Run a compare via Compare-IntuneBackupDirectories with the above two backup directories

Proposed solution:
Referencing file "\Public\Compare-IntuneBackupDirectories.ps1"

  • After looping through all files in the $referenceFiles variable, additionally check that no items which exist in the $differenceFiles variable were not present.
  • If new files are detected, notify user in the console
    • E.g. Write-Host "ADDED FILE: Difference directory file '[FilePath]' does not exist in the reference directory."

Solved in my pull request #44

Now available in IntuneBackupAndRestore version 3.2.0. Special thanks to @ztrhgf and PR #44