Tip: Use the Exchange Management Shell to Create New Mail Users and Mailboxes

You can use the Exchange Management Shell to create a new mail. The cmdlet you use is New-MailUser. You also need to supply a number of parameters that identify the name of the user and the external mail address. The syntax for creating a new mail user is:

New-MailUser -Name <name>  -FirstName <First>  -LastName <Last> 
-ExternalEmailAddress <externalmailaddress>  -UserPrincipalName
<userprincipalname>  -OrganizationalUnit <OU> 

Tips RSS Feed

Subscribe to the TechNet Magazine Tips RSS feed.

For example, to create a user named Marc Boyer with the external address marc.boyer@adventureworks.com, you could use the cmdlet:

New-MailUser -Name Marc -FirstName Marc -LastName Boyer -ExternalEmailAddress
marc.boyer@adventureworks.com -UserPrincipalName marc@contoso.com
-OrganizationalUnit contoso.com

You can also create a new mailbox resource using the Exchange Management Shell. The cmdlet you use for this is New-MailBox. Here, you also need to supply additional parameters, to identify the resource. The syntax for creating a new mailbox resource is:

New-Mailbox -database <"StorageGroup\MailboxDatabase">  -Name <Name> 
-OrganizationalUnit <"OU">  -DisplayName <"DisplayName">  -UserPrincipalName
<userprincipalname>  –Type

The type parameter will be either room or equipment. For example, to create a room mailbox named Train1 in an organizational unit named Training Rooms, you could use this cmdlet:

New-Mailbox -database "Storage Group 1\Mailbox Database 1" -Name Train1
-OrganizationalUnit "Training Rooms" -DisplayName "Train1" -UserPrincipalName
train1@contoso.com –Room

From the Microsoft Press book Microsoft Exchange Server 2007 Administrator’s Companion, Second Edition by Walter Glen, Scott Lowe, and Joshua Maher.

Looking for More Tips?

For more Exchange Server tips, visit the TechNet Magazine Exchange Server 2007 Tips page.

For more Tips on other products, visit the TechNet Magazine Tips index.