Create Office 365 Mailbox with Powershell

We can use the office 365 exchange powershell cmdlet New-Mailbox to create new mailbox, this command also creates an office 365 user account along with mailbox.

Note: Before proceed, Connect Exchange Online Remote PowerShell.

The below script creates an Exchange Online mailbox and Office 365 user account for the user Steve Smith. The optional parameter ResetPasswordOnNextLogon will require the user to reset their password the first time they sign in to Office 365.

New-Mailbox -Alias ssmith -Name ssmith -FirstName Steve -LastName Smith -DisplayName "Steve Smith" -MicrosoftOnlineServicesID [email protected] -Password (ConvertTo-SecureString -String 'MyP@ssw0rd' -AsPlainText -Force) -ResetPasswordOnNextLogon $true

After the mailbox creation, you will get below warning message

WARNING: After you create a new mailbox, you must go to the Office 365 Admin Center and assign the mailbox a license,
or it will be disabled after the grace period.

Once you created a mailbox by running this script, you have to activate this user account by assigning a license. To assign a license, refer this article: Manage Office 365 License with Powershell

Advertisement

Leave a Comment