Prev | Current Page 596 | Next

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

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


write-progress -Activity ???Processed User: $($user.name)??? -Status ???Progress:??? `
-PercentComplete ($total/$users.count*100)
}
Once the foreach loop has finished processing all users, the last code segment of the script uses Write-
Host to display a final summary message to the console screen. This message includes the total number
of users processed ( $total ), the total number of errors encountered during processing ( $errorTotal ),
and the path to the bulk-newmailbox.log file ( $logfile ).
# output the summary
Write-Host -Fore yellow ???`nProcessing complete. $total users were processed with
$errorTotal errors. Please refer to $logfile for more details.`n???
Running the Improved Script
The improved script has better error handling than the simple script. It does a better job of providing
error feedback to the user and suggests corrective action to take when needed. The user receives current
status information via the progress indicator as the script executes. All actions are recorded in a log file
for examination after the script completes.
The error handling incorporated into the improved script first becomes obvious when attempting to
run the script with invalid input information. The following examples demonstrate what happens when
input data fails preliminary testing before any main script processing is attempted.


Pages:
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608
agencja reklamowa wrocław kursy komputerowe poker online świadectwo energetyczne rzeszów nowy xj