The following
command quickly creates 2500 mailboxes:
[PS] C:\ > 1..2500 | ForEach { New-Mailbox -name ???PSTest$_??? -alias ???PSTest$_??? -
UserPrincipalName PSTest$_@ExchangeExchange.local -password $Password -database
???Mailbox Database??? -OrganizationUnit ADUsers }
Figure 4-36
Chapter 4: Working with User and Group Objects
135
Figure 4-37
Bulk - Enabling Existing Users
To bulk - enable existing users, you simply create a filter to get the required users to be bulk - enabled and
pass the output of the command to the Enable-Mailbox cmdlet.
To demonstrate this, create a few users in Active Directory. You can take advantage of the Net User
command, which has been available in the command prompt. If you need help using this command
simply type Net help net user in the Management Shell:
[PS] C:\ > 1..100 | ForEach { Net User ???PowerShell$_??? Pswd123 /ADD /Domain }
Part I: PowerShell for Exchange Fundamentals
136
Next you can use the Get-User cmdlet to list all 100 PowerShell users created. To avoid listing all the
users in the shell, you simply assign this output to a variable and pass it to the Enable-Mailbox cmdlet.
This is shown Figure 4 - 38 . Note that the screen was truncated so as not to show all 100 PowerShell users
mailbox - enabled.
Figure 4-38
Remember, you can always create a filter with PowerShell to filter existing users that are not mailbox -
enabled and pass that output to the Enable-Mailbox cmdlet.
Pages:
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232