Prev | Current Page 593 | Next

Joezer Cookey-Gam, Brendan Keane, Jeffrey Rosen, and Jonathan Runyon

"Professional Windows PowerShell for Exchange Server 2007 Service Pack 1"

log file with the contents of a
combination of variables that comprise the error message to be added to the log. These variables are
specified by the InputObject parameter followed by the variables ??™ names, separated by commas.
The $blankline variable defined earlier in the script adds a line of dashes to identify the beginning of
an error message in the log. The $errorString variable adds the error string identifying the user. The
$err[0] variable adds the specific error message generated by New-Mailbox . Note that $err is an
array, therefore to extract the error message it contains you must specify the first element in the array by
enclosing the index number (the first element is always 0) in square brackets. Finally, another
$blankline variable is used to add a line of dashes to mark the end of the error message.
After the error message is output to the log file, the $errorTotal variable is incremented by 1 . This is
accomplished using the addition assignment operator ( += ), which instructs Windows PowerShell to
assign a new value that is the current value plus 1.
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
}
The if statement is followed by an else statement.


Pages:
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
studia podyplomowe transport teksty piosenek Projekty domów wciągarki linowe teksty piosenek