Microsoft Planner: Enabling the Planner license via PowerShell

My earlier blog post was looking at disabling the license for Planner, while ensuring that other licenses that were already disabled didn’t get enabled as part of that process – Microsoft Planner-Disabling Planner license without enabling other licenses – but once you have tried Planner out and decided you do want to use it then how do I get it enabled for your users?  Thanks to Diana Balan for her help on the script.  The licensing of the plans under the Enterprise license is handled by coming up with a set of ‘disabled plans’ so the way to get Planner enabled is very similar to the way we disabled it – but we just make sure that PROJECTWORKMANAGEMENT is removed from the array of ‘disabled plans’ before applying this license option.  The same process could be used to enable any other single plan, such as Yammer or Sway.

image

This is my starting point – and I now want to activate Microsoft Planner.  The code is very similar to the previous blog – and again in this example I am just setting for one user – but you could loop around with some filter to set the license for multiple users.  The main change is not putting PROJECTWORKMANAGEMENT into the array to start with – and then checking that we do not add it.

$upn = “User@<tenant>.onmicrosoft.com”
$licensedetails = (Get-MsolUser -UserPrincipalName $upn ).Licenses
$ldo = @()
$licensedetails.Count;
if ($licensedetails.Count -gt 0){
        foreach ($ld in $licensedetails){
               if ($ld.AccountSkuId -eq “<tenant>:ENTERPRISEPACK”){
                       foreach ($lds in $ld.ServiceStatus){
                               if ($lds.ProvisioningStatus -eq “Disabled”){
                                         if ($lds.ServicePlan.ServiceName -ne “PROJECTWORKMANAGEMENT”){
                                                 $ldo = $ldo + $lds.ServicePlan.ServiceName.ToString()

                                         }
                               }
                       }
               }
       }

}

$LO = New-MsolLicenseOptions -AccountSkuId “<tenant>:ENTERPRISEPACK” -DisabledPlans $ldo
Set-MsolUserLicense -UserPrincipalName $upn -LicenseOptions $LO

 

image