Create Mailboxes with new AD account through Powershell


Script:
$Password=Read-Host “Enter Password” -AsSecureString
Import-CSV “C:\users.csv” | ForEach {New-Mailbox -Alias $_.alias -Name $_.name -userPrincipalName $_.UPN -Database “Mailbox Database 1” -OrganizationalUnit EmailUsers -Password $Password |Set-mailbox -EmailAddressPolicyEnabled $false -PrimarySmtpAddress $_.EmailAddress}

CSV File Format:

Alias

Name

UPN

EmailAddress

Alias: Alias name for the user(like:ajay.kakkar)
Name: Full user name(like: Ajay Kakkar)
UPN: User logon name(like: ajayk@contoso.com)
Email Address: User email address(like: ajaykakkar@contoso.com)

Note: Alias, UPN and Email Address could be same or different as per your requirement.

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