The $logfile variable is used to store the full path to the bulk-newmailbox.log file. The default
location is the My Documents folder of the currently logged on user. The Out-File cmdlet is used to
write to the file specified by $logfile , using the strings stored in $logheader as specified by the
InputObject parameter. The log file is created if it does not already exist. The Append parameter forces
Out-File to add to the end of an existing log file instead of overwriting it.
# Initialize log file
$datetime = Get-Date
$logHeader = ???
*******************************************************************
Run time = $dateTime using input file $CSVUPath
*******************************************************************???
$logFile = ???$home\My Documents\bulk-newmailbox.log???
Out-File $logFile -InputObject $logHeader -Append
Chapter 15: User, Group, and Public Folder Administration
439
This code segment sets several variables that are used during mailbox creation to track processing and
write information to the log file. The $err variable is used by the New-Mailbox cmdlet to store any
errors it encounters. The $blankLine variable is used to store a string value that is simply a series of
dashes. This string is used later in the script when error messages are written to the log file, to make
them more readable.
Pages:
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602