sábado, 27 de junho de 2015

How to Migrate User account License on Office 365 using PowerShell

If you or your company has contracted an Office 365 Microsoft's plan and has attributed this plan / license its user and then want to migrate these users to another license, follow the steps below:

1. Find out the names of the licenses you already have hired
for this use this command: Get-MsolAccountSku
2.Conect via powershell to your Office 365 ambinte
3. Use this script filling the information of variables


$OldLicense = "Name of old License"
$NewLicense = "Name of new License"

$users = Get-MsolUser -All
foreach($user in $users)
{
Write-Host $user.UserPrincipalName
Set-MsolUserLicense -AddLicenses $NewLicense -RemoveLicenses $OldLicense -UserPrincipalName $user.UserPrincipalName
Write-Host "User updated!"
}