# http://www.visualbasicscript.com/m_62487/tm.htm #--------------------==--------------------# #-------------- Description --------------# # # This script takes an input file (example shown below) and looks # for any Public Folders where the items counts for all the # replicas are not identical. #--------------- Input File ---------------# # # The input file is generated from the output of my PowerShell script # Compare_Public_Folders_Between_Ex2000_and_Ex2007.ps1. An excerpt of # this file is shown below. # # # # # # # 2008 # 7 # 15 # # # # # # 2008 # 7 # 15 # # # # # UserID # NewMailServer # OldMailServer # Add # # # # Access Issues # \Access\Access Issues # HTTP://OldMailServer/public/Access/Access Issues # HTTP://OldMailServer/public/Access/Access%20Issues # # cocsxchng01 # http://OldMailServer # # # NewMailServer # https://NewMailServer # 26 # 540999 # # #----------------- Output -----------------# # # This is an example of the output that is displayed on screen. # # Item Count mismatch for folder # \Finance\Conference Call Calendar # OldMailServer : 71 # NewMailServer : 55 # Item Count mismatch for folder # \Marketing\Administration\Team A # OldMailServer : 2655 # NewMailServer : 2653 # Done. set-psdebug –strict; # Require declaration of powershell variables # Set-PSDebug -Off; # Do not require declaration of variables $strPathToFile = "U:\Development"; $strFileName = "XMLDoc.old.txt"; $xmlLog = [xml]( Get-Content (join-path -path $strPathToFile $strFileName)); $colPublicFolders = $xmlLog.Public_Folders.Public_Folder; foreach ($objPublicFolder in $colPublicFolders) { # If there was only one replica for a folder, then # ($objPublicFolder.Replica -is [array]) would return false if ($objPublicFolder.Replica -is [array]) { $Item_Count_for_First_Replica = $objPublicFolder.Replica[0].Item_Count; $colReplicas = $objPublicFolder.Replica; $mismatch = $False; # Compare the item count for each replica against # the first replica item count. foreach ($objReplica in $colReplicas) { If ($objReplica.Item_Count -ne $Item_Count_for_First_Replica) { $mismatch = $True; } } if ($mismatch -eq $True) { Write-Host "Item Count mismatch for folder`n`t" $objPublicFolder.Path; foreach ($objReplica in $colReplicas) { Write-Host "`t" $objReplica.Server_Name ": " $objReplica.Item_Count;} } } $colReplicas = $Null; $Item_Count_for_First_Replica = $Null; $objReplica = $Null; } $strPathToFile = $Null $strFileName = $Null $objPublicFolder = $Null; $colPublicFolders = $Null; $xmlLog = $Null; Write-Host "Done.";