Forum Discussion
Powershell to add apps to a licensed user
- Apr 24, 2020
Sahin Boluk Here is the PowerShell I used to re-enable all the features for the users with Office 365 E3 licenses in our tenant:
Connect-AzureAD $license = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense $licenses = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses $license.SkuId = (Get-AzureADSubscribedSku | Where-Object -Property SkuPartNumber -Value "ENTERPRISEPACK" -EQ).SkuID $licenses.AddLicenses = $license Get-AzureAdUser -All $true | foreach {if (($_.AssignedLicenses).SkuID -contains $license.SkuID) {Set-AzureAdUserLicense -ObjectID $_.UserPrincipalName -AssignedLicenses $licenses}}You could modify it to only enable a selection of features by setting the DisabledPlans property of the $license object as shown here: https://docs.microsoft.com/en-us/powershell/azure/active-directory/enabling-licenses-sample?view=azureadps-2.0
Thank you Peter. This is something we can definitely look into going forward, but does look like some setup is required to "migrate" all of the 400+ users we have on MS Teams so far from Direct assignment to Group assignment.
Sahin Boluk Here is the PowerShell I used to re-enable all the features for the users with Office 365 E3 licenses in our tenant:
Connect-AzureAD
$license = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicense
$licenses = New-Object -TypeName Microsoft.Open.AzureAD.Model.AssignedLicenses
$license.SkuId = (Get-AzureADSubscribedSku | Where-Object -Property SkuPartNumber -Value "ENTERPRISEPACK" -EQ).SkuID
$licenses.AddLicenses = $license
Get-AzureAdUser -All $true | foreach {if (($_.AssignedLicenses).SkuID -contains $license.SkuID) {Set-AzureAdUserLicense -ObjectID $_.UserPrincipalName -AssignedLicenses $licenses}}You could modify it to only enable a selection of features by setting the DisabledPlans property of the $license object as shown here: https://docs.microsoft.com/en-us/powershell/azure/active-directory/enabling-licenses-sample?view=azureadps-2.0