The $thisError variable is used to store the contents of $errorString plus the text
string shown to form the error message written to the log file. Also $noErrors is set to $false and
$errorTotal is incremented by 1.
else
{
$thiserror = $errorString + ???Distribution Group based on
Department `??™$($user.department)`??™ could not be found???
out-file $logfile -append -inputobject $blankline, `
$thiserror, $blankline
$noErrors = $false
$errorTotal += 1
}
At this point all operations related to adding the current user to a Distribution Group based on the
Department attribute value are complete.
The next segment of code adds the user to a Distribution Group based on the Office attribute value and
is identical in form to the code described in the last few paragraphs so an in - depth examination is not
required. Instead we can skip ahead to the last segment of new code.
A final if statement is used to check the state of the variable $noErrors . If it is still $true , then there
have been no errors and the success message for the current user is written to the log file. If $noErrors
is $false , then an error message for the current user has already been written to the log file and the if
statement is skipped. At this point all processing for the current user is complete.
Pages:
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619