Thursday, October 30, 2014

Bulk Uploading Mailboxes to Exchange Online and assigning licenses


Microsoft have made it really easy to perform bulk migrate migrations and assign licenses in Exchange Online.

You can export a csv and use it twice. The first csv will have the following headings

emailaddress
sean.ofarrell@contoso.com
ciaran.ofarrell@contoso.com
dean.jones@contoso.com
tecnicalfellow@contoso.com 

You can then upload the file then via the following option in Exchange Online 


And then to assign the licenses use the same csv but change the top heading to userprincipalname like below

userprincipalname
sean.ofarrell@contoso.com
ciaran.ofarrell@contoso.com
dean.jones@contoso.com
tecnicalfellow@contoso.com 

Connect to Office365 via the Windows Azure Active Directory Module for Windows PowerShell and do the following.


# First of all paste in the following variables

$AccountSkuId = "contoso:EXCHANGESTANDARD"
$UsageLocation = "IE"

# The paste the command in below with the correct CSV file path

$Users = Import-Csv "C:\Users\ergo\Desktop\Scripts\Import_users.csv"
$Users | ForEach-Object {
Set-MsolUser -UserPrincipalName $_.UserPrincipalName -UsageLocation $UsageLocation
Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLicenses $AccountSkuId
}

And if you wanted to assign Exchange Online P2 Licenses then run the following commands,

# First of all paste in the following variables

$AccountSkuId = "contoso:EXCHANGEENTERPRISE"
$UsageLocation = "IE"

# The paste the command in below with the correct CSV file path

$Users = Import-Csv "C:\Users\ergo\Desktop\Scripts\Import_users.csv"
$Users | ForEach-Object {
Set-MsolUser -UserPrincipalName $_.UserPrincipalName -UsageLocation $UsageLocation
Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLicenses $AccountSkuId
}

If you are using waad and want to assign a user with a P2 license an archive then you need to populate the AD attribute for the user “msExchRemoteRecipientType' and change the value to 3. This can be done in bulk via ADMODIFY or Powershell