Selective Licensing

Selective Licensing | Remove a particular license from a user account:

When you sign up for an O365 subscription, it often clubs multiple services together. For example: I have the E3 subscription so if I assign an “Office 365 Enterprise E3” license to a user, the user will get the all the services available in that subscription, like Microsoft Planner, Sway, Yammer Enterprise, Azure Rights Management, O365 ProPlus, Office Online, Skype for Business, SharePoint Online, and Exchange Online.

 I might not want some user to get Sway, Yammer or Microsoft Planner. I could simply edit the license for each user by clicking the drop down and unchecking one of the licenses for each user however this process gets cumbersome if I have a lot of user like 1000.

For that I could use PowerShell.

  • Run PowerShell (Azure Active Directory Module) as admin
  • Connect-MSOLservice | this will connect you to MSOL (O365 User Management)
  • Get-MsolAccountSku | this will show you your “AccountSkuId” – Mine is spodawgs:ENTERPRISEPACK

  • Get-MsolAccountSku | Where-Object {$_.SkuPartNumber -eq ‘ENTERPRISEPACK’} | ForEach-Object {$_.ServiceStatus} | this command will show you the services in your bundle

  • Get-MsolUser -All | where {$_.IsLicensed -eq “true” } | Format-List UserPrincipalName | this command will give you a list of licensed users

  • For this exercise I will use the user account
  • (Get-MsolUser -UserPrincipalName “”).Licenses.ServiceStatus | this command will show me all the active services (in the Enterprise pack) for this user account

  • I feel like removing SWAY for this user account so I run the 3 commands that are listed below
  • Set-MsolUser -UserPrincipalName “” -UsageLocation US
  • $myO365Sku1 = New-MsolLicenseOptions -AccountSkuId spodawgs:ENTERPRISEPACK -DisabledPlans SWAY
  • Set-MsolUserLicense -UserPrincipalName -LicenseOptions $myO365Sku1
  • (Get-MsolUser -UserPrincipalName “”).Licenses.ServiceStatus | I run this command to check if SWAY is disabled

  • SWAY is disabled
  • Check online
  • To do the same thing for all users in your tenant we can run a .csv file
  • To create the .csv file > open Excel add a column UserPrincipalName > Save as .csv (I saved it to the C drive root) > named the file “users” thus the location would be c:\users.csv
  • Import-Csv -Path c:\users.csv | ForEach-Object {(Get-MsolUser -UserPrincipalName $_.UserPrincipalName).Licenses.ServiceStatus} | I ran this command to check the provisioning status for the 4 users (you can see that SWAY is activated for the users. The list is long)

  • I feel like removing SWAY for these users account so I run the 3 commands that are listed below
  • Import-Csv -Path c:\users.csv | ForEach-Object {(Set-MsolUser -UserPrincipalName $_.UserPrincipalName)}
  • $myO365Sku1 = New-MsolLicenseOptions -AccountSkuId spodawgs:ENTERPRISEPACK -DisabledPlans SWAY
  • Import-Csv -Path c:\users.csv | ForEach-Object {Get-MsolUser -UserPrincipalName $_.UserPrincipalName | Set-msoluserlicense -LicenseOptions $myO365Sku1}

  • Sway is now disabled for all the accounts