Assign Office 365 Licenses via Powershell

OK. So I needed to do this. Assign a new type of license to users who already were using a particular MS license and don’t waste time assigning that new license to users who were already using it. So for this example, we’ll assign a MS 365 E3 license to users who did not already have it AND have been using a Office 365 E3 license.

Step 1:

Get-MsolAccountSku

This will output your AccountSkuid. It’s of the form
<tenant>:<license name>
ie
companyname:POWER_BI_PRO

You need to know the name of the license you’re targeting. In this case…
A Microsoft 365 E3 license uses the label “SPE_E3” and an Office 365 E3 license uses the label “ENTERPRISEPACK”.

Step 2:

The command to assign an MS 365 E3 license only to users who already have an O365 E3 license

Get-MsolUser -All -EnabledFilter EnabledOnly | Where-Object {$_.licenses.AccountSkuid -notcontains "mycompany:SPE_E3"} | Where-Object {$_.licenses.AccountSkuid -contains "mycompany:ENTERPRISEPACK"} | Set-MsolUserLicense -AddLicenses "mycompany:SPE_E3"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website at WordPress.com
Get started
%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close