This section covers four sample scripts for automating the creation of new mailbox -enabled accounts.
The first script is very simple and covers the basics you need to know when creating a script that
uses Exchange Management Shell commands. A second script expands on the first to add error
Part IV: Automating Administration
426
control and advanced techniques for developing a more comprehensive solution. A third script extends the
second by adding automated group membership based on department and office attributes. A fourth script
takes things a step further and automates database selection based on the last name of the new user.
The scripts in this section use these cmdlets:
??‘ Read-Host
??‘ New-Mailbox
??‘ Import-Csv
??‘ Write-Host
??‘ Out-File
??‘ Test-Path
??‘ Write-Progress
??‘ Set-User
??‘ Add-DistributionGroupMember
??‘ Get-DistributionGroup
The Simple Script
The sample script simplebulk-newmailbox.ps1 creates mailbox - enabled user accounts based on the
contents of a comma - separated value (CSV) file created by the administrator. The script is run by
entering its name followed by the path to the CSV file used as input. The administrator is prompted once
to enter a secure temporary password that is set on each account as it is created. The results are
displayed at the command line as the default output from the underlying Exchange Management Shell
command used in the script to create the mailboxes.
Pages:
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579