Friday, March 22, 2013

Mailbox enable a user in Office 365 using PowerShell

I was searching high and low for this all around the internet. Enable-mailbox doesn't seem to work, New-Mailbox also doesn't do it... It turns out that the solution is one that doesn't make sense at all.

Apparently all you need to do in Office 365 is to assign a license (an MsolAccountSku) to the user, and the mailbox will be automatically provisioned based on the UPN. That easy!

Here are the commands...

First, get your Account SkuID:
$sku = Get-MsolAccountSku

Then set a location for the user (else you can add a license):
Set-MsolUser -UserPrincipalName user@domain.onmicrosoft.com \
-UsageLocation "SG"

Then, add the account SkuID to the user:
Set-MsolUserLicense -UserPrincipalName \
user@domain.onmicrosoft.com -AddLicenses $sku.AccountSkuId

Then you wait as the mailbox is provisioned in the background.

No comments:

Post a Comment