Post Migration Scripts for O365 – Part 1 Set usage location and Enable License from a csv file

When you are migrating users to O365 there may be a requirement to run post migration scripts, for setting the users location, and enabling licenses. You may be performing the migrations using a csv, and users may be in different locations, so you cannot just run the commands against the entire organisation. The csv contains a list of User UPNs.

### First we must find out our License SKU to apply



### Set a users location to GB


Import-CSV "C:\UKUsers.csv" | %{Get-MSolUser -SearchString $_.UserPrincipleName | Set-MsolUser -UsageLocation GB | ft UserPrincipalName,DisplayName,IsLicensed,UsageLocation}

### Set users license, also disable Plans that are not needed, in our case we are just using Exchange Online so we disable everything else



Import-CSV "C:\UKUsers.csv" | %{Set-MsolUserLicense $_.UserPrincipleName –AddLicenses companyname:ENTERPRISEPACK –LicenseOptions $LicenseOptions}

Facebooktwittergoogle_pluslinkedinby feather

Leave a Reply

Your email address will not be published. Required fields are marked *