OrganizationalUnit `
-UserPrincipalName:$user.UserPrincipalName `
-FirstName:$user.FirstName -LastName:$user.LastName `
-Password:$password -ResetPasswordOnNextLogon:$true `
-ErrorVariable err | Out-Null
If ($err -ne $null)
{
$errorString = ???[ERROR]: Processing user $($user.name) failed with the
following error:???
Out-File $logfile -Append -Inputobject $blankline, `
$errorString, $err[0], $blankline
$errorTotal += 1
}
else
{
$errorString = ???[ERROR]: Creation of mailbox enabled account for user
$($user.name) succeeded, but ???
Set-User -Identity:$user.name -Department:$user.department `
-Office:$user.office -ErrorVariable err
If ($err -ne $null)
{
$errorString += ???property assignment failed with error:???
Out-File $logFile -Append -Inputobject $blankLine, $errorString, `
$err[0], $blankLine
$errorTotal += 1
}
else
{
$noErrors = $true
if ($dgdept = (Get-DistributionGroup | where {$_.name -like `
???*$($user.department)*???}))
{
Add-DistributionGroupMember -Identity:$dgdept `
-Member:$user.name -ErrorVariable err
If ($err -ne $null)
{
$thiserror = $errorString + ???addition to Distribution Group
$($dgdept.name) failed with error:???
out-file $logfile -append -inputobject $blankline, `
$thiserror, $err[0], $blankline
$noErrors = $false
$errorTotal += 1
}
}
Chapter 15: User, Group, and Public Folder Administration
445
else
{
$thiserror = $errorString + ???Distribution Group based on
Department `??™$($user.
Pages:
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613