Hi there
i have a code which compares 3 “states” of a user mailbox size
initial(from a csv)
start(quick live run based on list)
finish(quick run based on list 5 sec after)
i am running them concurrently using invoke-all to save time using jobs.
i am not sure i am even using the right approach since the list gets unsorted(i think) which makes the compare not work right
so i tried using sort but im still not it compares the right data from the same user in all 3 “phases”.
bottom line is i have 3 “lists” of data that i need to compare the same unique user on and see what the differences are and report/store based on that(did the size increase or not…)
heres the code if anyone has an idea or better way to do it:
$s=import-csv c:\files\users.csv |Sort-Object displayname -Descending
$s1=import-csv c:\files\users.csv |Invoke-All {Get-MailboxStatistics -Id $.displayname} -Force |Sort-Object displayname -Descending
Start-Sleep 5
$s2=import-csv c:\files\pilot0sizebefore.csv |Invoke-All {Get-MailboxStatistics -Id $.displayname} -Force|Sort-Object displayname -Descending
$Finished=@()
$Notfinished=@()
foreach ($i in $s){
Write-Host “Working on $($i.displayname)” -ForegroundColor Yellow
$1=$i.TotalItemSize
foreach ($j in $s1){
Write-Host “Working on $($j.displayname)” -ForegroundColor Yellow
$2=$j.TotalItemSize
foreach ($n in $s2){
Write-Host “Working on $($n.displayname)” -ForegroundColor Yellow
$3=$n.TotalItemSize
$1
$2
$3
if($1 -eq $2){write-host $($i.displayname) -ForegroundColor red “Restore Started”}
if ($2 -eq $3){write-host $($i.displayname) -ForegroundColor green “Restore Ended”;$Finished+=$i}
else {$Notfinished+=$i}
}}}
any help would be greatly appreciated
Thanks