Link to home
Start Free TrialLog in
Avatar of nav2567
nav2567Flag for United States of America

asked on

Public Folder migration statistics - compare get-publicfolderstatistics results.

I am replicating public folders from one mailbox server to another one.  

I have found the below script to compare both servers to keep track of progress.  

Would someone please modify the script to output the result to a file?  

Thanks.

write-host “getting first server…”
$pfs01 = Get-PublicFolderStatistics -ResultSize unlimited -server | sort folderpath
 write-host “getting second server…”
$pfs02 = Get-PublicFolderStatistics -ResultSize unlimited -server | sort folderpath
 write-host “Doing stuff…”

$count = 0

$pfs01 | foreach {
 $items = $_.itemcount
 $pat = $_.folderpath

$item2 = $pfs02[$count].itemcount
 $pat2 = $pfs02[$count].folderpath
 $mod2 = $pfs02[$count].LastModificationTime

$dif = $items – $item2

$message = ” `”$items`”, `”$item2`”, `”\$pat`”, `”\$pat2`”, `”$mod2`””
Write-host “$message” -f green

if ($dif -gt 1) { # adjust this number >=1 to account for changes/replication
 # NOTE: if paths do not match, some folders do not exist on both servers.
 $message = ” `”$items`”, `”$item2`”, `”\$pat`”, `”\$pat2`”, `”$mod2`””
Write-host “$message” -f red
 out-file -inputobject $message -NoClobber -Append -FilePath .\pflog.log
 $found = “true”
}
 $count=$count +1
 }
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

It already outputs to a file though. That's what this line does:
out-file -inputobject $message -NoClobber -Append -FilePath .\pflog.log

Open in new window

What's would you like to see that isn't already in there?

Chris
Avatar of nav2567

ASKER

Hey Chris,

Is there another compare tool/script I could use to see the same/differences of folders after the migration of the public folder?  

I use these commands to replicate the public folders to the new mailbox server.  Eventually, the old mailbox server will be shut.  

.\AddReplicaToPFRecursive.ps1 -TopPublicFolder “\” -ServerToAdd “mynewmailboxserver”
.\AddReplicaToPFRecursive.ps1 -TopPublicFolder “\NON_IPM_SUBTREE” -ServerToAdd “mynewmailboxserver”

Many thanks.
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nav2567

ASKER

Works.

Thanks, Dent!!!
Avatar of nav2567

ASKER

Thank you!!!