department)`??™ could not be found???
out-file $logfile -append -inputobject $blankline, `
$thiserror, $blankline
$noErrors = $false
$errorTotal += 1
}
if ($dgoff = (Get-DistributionGroup | where {$_.name -like `
???*$($user.office)*???}))
{
Add-DistributionGroupMember -Identity:$dgoff `
-Member:$user.name -ErrorVariable err
If ($err -ne $null)
{
$thiserror = $errorString + ???addition to Distribution Group
$($dgoff.name) failed with error:???
out-file $logfile -append -inputobject $blankline, `
$thiserror, $err[0], $blankline
$noErrors = $false
$errorTotal += 1
}
}
else
{
$thiserror = $errorString + ???Distribution group based on Office
`??™$($user.office)`??™ could not be found???
out-file $logfile -append -inputobject $blankline, `
$thiserror, $blankline
$noErrors = $false
$errorTotal += 1
}
if ($noErrors)
{
$outstring = ???[SUCCESS]: Creation of mailbox enabled account
for user $($user.name) succeeded, with mailbox on database: $($user.database)???
out-file $logfile -inputobject $outstring -append
}
}
}
$total = $total + 1
write-progress -activity ???Processed User: $($user.name)??? -status ???Progress:??? `
-percentcomplete ($total/$users.count*100)
}
Part IV: Automating Administration
446
Examining the bulk - newmailbox.v2.ps1 Script
The first few lines of this foreach block are identical to those used in v1 of the script.
Pages:
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614