Use the Shell to create a mail user
This example creates a mail-enabled user account for Jeffrey Zeng in Exchange Server with the following details:
- The name and display name is Jeffrey Zeng.
- The alias is jeffreyz.
- The external email address is jzeng@tailspintoys.com.
- The first name is Jeffrey and the last name is Zeng.
- The logon name is jeffreyz@contoso.com.
- The password is Pa$$word1.
- The mail user will be created in the default OU. To specify a different OU, you can use theOrganizationalUnit parameter.
New-MailUser -Name "Jeffrey Zeng" -Alias jeffreyz -ExternalEmailAddress jzeng@tailspintoys.com -FirstName Jeffrey -LastName Zeng -UserPrincipalName jeffreyz@contoso.com -Password (ConvertTo-SecureString -String 'Pa$$word1' -AsPlainText -Force)
This example creates a mail-enabled user account for Rene Valdes in Exchange Online.
New-MailUser -Name "Rene Valdes" -Alias renev -ExternalEmailAddress renevaldes@fineartschool.edu -FirstName Rene -LastName Valdes -MicrosoftOnlineServicesID renev@contoso.com -Password (ConvertTo-SecureString -String 'P@ssw0rd' -AsPlainText -Force)
How do you know this worked?
To verify that you've successfully created a mail user, do one of the following:
- In the EAC, navigate to Recipients > Contacts. The new mail user is displayed in the list of contacts. Under Contact Type, the type is Mail user.
- In the Shell, run the following command to display information about the new mail user.
Get-MailUser <Name> | FL Name,RecipientTypeDetails,ExternalEmailAddress