Forum Discussion

Sahin Boluk's avatar
Sahin Boluk
Copper Contributor
Apr 24, 2020
Solved

Powershell to add apps to a licensed user

Hi, we are rolling out MS Teams to our users.  In doing so we are only enabling users with a E3 license and ONLY MS Teams.  We got that going with scripts and Powershell.  Now we want to add Streams to these users.  I could not find a way or command to add that to users that are already enabled.  Going forward, we removed Streams from the DisabledPlans variable in our script.

 

Any suggestions/help would be appreciated 🙂

  • 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

4 Replies

    • Sahin Boluk's avatar
      Sahin Boluk
      Copper Contributor

      PeterRising 

      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.

      • PeterRising's avatar
        PeterRising
        MVP

        Sahin Boluk 

         

        Is your script something along the lines of the below?  Does removing Stream from the DisabledPlans and then running against your csv file not have the desired effect?

         

        Connect-MsolService

        $LO = New-MsolLicenseOptions -AccountSkuId "reseller-account:ENTERPRISEPACK" -DisabledPlans "SWAY", "FLOW_O365_P2", "POWERAPPS_O365_P2", "YAMMER_ENTERPRISE"

        import-csv '.\test.csv' | foreach {
        Set-MsolUser -UserPrincipalName $_.UserPrincipalName -usagelocation 'GB' 
        Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLicenses reseller-account:ENTERPRISEPACK -LicenseOptions $LO}

         

        Maybe try this with a csv with one test user first to see if it works for you.  This is one I ran quite some time ago now and I've not had the chance to test it for you myself just yet.  Will have a look if I get the chance.