Exchange 2007–>Bulk Create Mailbox

Create a CSV file with columns as below:

Database Password Name  OU Alias fqdn
 

##Create password as secure string

$data = import-csv $args[0]

## Create a function to convert password into a secure string

function New-SecureString([string] $plainText)

{

$secureString = new-object System.Security.SecureString

foreach($char in $plainText.ToCharArray())

{

$secureString.AppendChar($char)

}

$secureString

}

foreach ($i in $data)

{

$ss = new-securestring $i.password

$upn = $i.alias + “@” + $i.fqdn

new-mailbox -Password $ss -Database $i.database -UserPrincipalName $upn -Name $i.name -OrganizationalUnit $i.ou

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s