Friday, March 17, 2017

Simple Folder compare script


DFS Replication was doing something strange when I enabled replication during the day.  Had a user complain that they were missing a file.  Another user said the same, so I needed to do a simple folder compare to see if there were differences.  The folders were different in *.tmp and ~*.* files, but I did find 7 files that were not on both replication partners.

Used the following script to do the comparison:

PS L:\shared\Peds IT\Nerds\Reggie\dfsr> $fso = get-childitem -recurse -path "Y:\replicated"
PS L:\shared\Peds IT\Nerds\Reggie\dfsr> $fsoBU = get-childitem -recurse -path "Z:\original
PS L:\shared\Peds IT\Nerds\Reggie\dfsr> Compare-Object -ReferenceObject $fsoBU -DifferenceObject $fso


Reference:   Easily Compare Two Folders with Powershell

No comments:

Post a Comment