Prev | Current Page 616 | Next

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

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

The variables are set as arrays by using the @ character before a set of parentheses
holding each individual string character value separated by commas.
# Create arrays to collate user based on first character of last name
$a2f = @(???a???, ???b???, ???c???, ???d???, ???e???, ???f???)
$g2k = @(???g???, ???h???, ???i???, ???j???, ???k???)
$l2p = @(???l???, ???m???, ???n???, ???o???, ???p???)
$q2t = @(???q???, ???r???, ???s???, ???t???)
$u2z = @(???u???, ???v???, ???w???, ???x???, ???y???, ???z???)
The New-Mailbox command in the foreach loop has to be modified as well because the mailbox
database values are not taken from the user CSV file. To set the mailbox database value stored in the
variable $database , the getdatabase function is called using the current user ??™ s last name as an input
value. Once the value is set, it is used to specify the Database parameter value for New-Mailbox .
# Create the mailbox enabled accounts
foreach ($user in $users)
{
$database = (getdatabase $user.LastName)
New-Mailbox -Name:$user.name -Database:$database `
-OrganizationalUnit:$user.OrganizationalUnit `
-UserPrincipalName:$user.UserPrincipalName `
-FirstName:$user.FirstName -LastName:$user.LastName `
-Password:$password -ResetPasswordOnNextLogon:$true `
-ErrorVariable err | Out-Null
Finally, the success output message written to the log file has been updated to use the value stored in
$database to report where the mailbox was created.


Pages:
604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628
tanie pokoje miedzyzdroje drzwi drewniane alveo upadlanych.waw.pl Rowy noclegi