I know there are already a lot of resources for this subject. I finally took a lot of time to
set up everything like expected. I decided to create an article for this.
My need was to add PowerApps to all our users. I needed to do this for a lot of users, no
way for me to do it manually and that was the opportunity to be able to manage correctly
Office 365 licenses.
According to my research, there is no option to add only PowerApps. Microsoft explains
how to disable services with PowerShell. By the way, it was not obvious to me, you
have a license that includes apps like Word, Outlook, SharePoint, Planner, and theses
are the services.
For example, with E3 licenses (2020.15.10) there are the following services
Service Plan Name | String ID |
---|---|
EXCHANGE_S_ENTERPRISE | Exchange Online |
FORMS_PLAN_E3 | Forms |
SHAREPOINTENTERPRISE | SharePoint Online |
TEAMS1 | Teams |
OFFICESUBSCRIPTION | Microsoft 365 Apps for enterprise (Word, Excel,…) |
How do I know which licenses and services are assigned to users?
You can find many scripts for this on the Internet, here is my tool which is not necessarily the
best for you, depends on what you need. I provide it as is.
Use this command to view your available licensing plans. It will be necessary to set the variable $LO.
#Connect-MsolService Get-MsolAccountSku | Select AccountSkuId | Sort AccountSkuId
My tool to check the licenses and services used
#Connect-MsolService $i = 0 $sam = "WhatYouWant" # Use this for test purpose $Users = Get-MsolUser -SearchString $sam # License E3 $Users = Get-MsolUser -all -EnabledFilter EnabledOnly | ? {$_.isLicensed -eq "True" -and $_.UserPrincipalName -notlike "*WhatYouWant*" -and $_.UserPrincipalName -notlike "*WhatYouWant*"} | Sort DisplayName # License A3 $Users = Get-MsolUser -all -EnabledFilter EnabledOnly | ? {$_.isLicensed -eq "True" -and $_.UserPrincipalName -like "*WhatYouWant*"} | Sort DisplayName $ArrayUsersLic = @() foreach($User in $users){ $ServiceName = $ServicePlan.ServicePlan.ServiceName | sort $ObjUsersLic = [PSCustomObject]@{ UserPrincipalName = $User.UserPrincipalName License = $Licenses ServiceName = $ServiceName } $ArrayUsersLic += $ObjUsersLic } # Display data from our object foreach($j in $ArrayUsersLic){ write-host $j.UserPrincipalName -f Yellow foreach($service in $j.ServiceName){ if($service -eq "POWERAPPS_O365_P2"){"PowerApps OK"} } # Add anything you need there } $id = 0 ; $ArrayUsersLic[$id].UserPrincipalName; $ArrayUsersLic[$id].ServiceName; $ArrayUsersLic[$id].ServiceName.Count
A good script to have an entire report
Get Friendly licencsename for all users in office 365 using Powershell
Enable license and disable services you don’t want for your users in once
You first need to know about the product included in your license plan. After the most
complicated is to understand is what are all these plans “MCOSTANDARD”,
“MICROSOFTBOOKINGS”, “PROJECT_O365_P2”, “SWAY”, “YAMMER_ENTERPRISE”.
After you know what you need to disable, you can follow the official instruction here.
Here is my tool for E3 license
#Connect-MsolService # Connect-MsolService # Only E3 $Users = Get-MsolUser -all -EnabledFilter EnabledOnly | ? {$_.isLicensed -eq "True" -and $_.UserPrincipalName -notlike "*fvecorp*" -and $_.UserPrincipalName -notlike "*ecole-construction*"} | Sort DisplayName $i = 0 # For test purpose #$Users = Get-MsolUser -all -EnabledFilter EnabledOnly | ? {$_.isLicensed -eq "True" -and $_.UserPrincipalName -eq "Greder.Yann@fve.ch"} | Sort DisplayName $Services = "EXCHANGE_S_ENTERPRISE", "MYANALYTICS_P2", "MCOSTANDARD", "CDS_O365_P2", "Deskless", "DYN365_CDS_O365_P2", "FLOW_O365_P2", "KAIZALA_O365_P3", "MICROSOFTBOOKINGS", "MIP_S_CLP1", "POWER_VIRTUAL_AGENTS_O365_P2", "PROJECT_O365_P2", "RMS_S_ENTERPRISE", "SWAY", "YAMMER_ENTERPRISE" foreach($User in $Users){ $i = $i + 1; cls; write-host ([int]$PercentComplte = $i/$Users.Count*100) " %" write-host "Traitement $($User.UserPrincipalName)" -f Yellow $LO = New-MsolLicenseOptions -AccountSkuId YourTenant:ENTERPRISEPACK -DisabledPlans $Services Set-MsolUserLicense -UserPrincipalName $User.UserPrincipalName -LicenseOptions $LO }
And for A3 license
#Connect-MsolService # Only A3 $Users = Get-MsolUser -all -EnabledFilter EnabledOnly | ? {$_.isLicensed -eq "True" -and $_.UserPrincipalName -like "*WhatYouWant*"} | Sort DisplayName $i = 0 # For test purpose # $Users = Get-MsolUser -all -EnabledFilter EnabledOnly | ? {$_.isLicensed -eq "True" -and $_.UserPrincipalName -eq "name@domnain"} | Sort DisplayName $Services = "ADALLOM_S_O365", "EXCHANGE_S_ENTERPRISE", "MYANALYTICS_P2", "MCOSTANDARD", "AAD_BASIC_EDU", "CDS_O365_P2", "Deskless", "DYN365_CDS_O365_P2", "EducationAnalyticsP1", "FLOW_O365_P2", "KAIZALA_O365_P3", "MICROSOFTBOOKINGS", "MIP_S_CLP1", "POWER_VIRTUAL_AGENTS_O365_P2", "PROJECT_O365_P2", "RMS_S_ENTERPRISE", "SCHOOL_DATA_SYNC_P2", "SWAY", "YAMMER_EDU" foreach($User in $Users){ cls $i = $i + 1; cls; write-host ([int]$PercentComplte = $i/$Users.Count*100) " %" write-host "Traitement $($User.UserPrincipalName)" -f Green $LO = New-MsolLicenseOptions -AccountSkuId YourTenant:ENTERPRISEPACKPLUS_FACULTY -DisabledPlans $Services Set-MsolUserLicense -UserPrincipalName $User.UserPrincipalName -LicenseOptions $LO }
According to my tests, if you disable the license, it is straight forward, but when you
disable services, it takes many hours.