No one has responded to this discussion for at least a year, so this information may be out of date. If you're looking for information about this topic, please search for a more recent discussion or post a new question.

Adding license options to an existing user with Powershell

  • 2 Followers
  • 3 Replies |
  • This post has 1 verified answer |
Answered (Verified) This question is answered

This is the scenario:

A user is synched to Office 365 with the Active Directory Synch and it is assigned a license package for our "domain:ENTERPRISEPACK"  with some services disabled. Lets say Office Professional, Sharepoint and Exchange enabled, Lync Online & Office Web Apps disabled. This can be done with:

 

PS C:\Windows\system32> $DisableSStatus = New-MsolLicenseOptions -AccountSkuId domain:ENTERPRISEPACK -DisabledPlans SHAREPOINTWAC,MCOSTANDARD
PS C:\Windows\system32> Set-MsolUserLicense -UserPrincipalName florian.cloudtest
@domain.com -addlicenses domain:ENTERPRISEPACK
PS C:\Windows\system32> Set-MsolUserLicense -UserPrincipalName florian.cloudtest
@domain.com -licenseoptions $DisableSStatus

 

Now I want to add some features some time later but I cant seem to add any services only disable them!

PS C:\Windows\system32> Set-MsolUserLicense -UserPrincipalName florian.cloudtest
@domain.com -addlicenses domain:ENTERPRISEPACK

 

FAILS:

Set-MsolUserLicense : Unable to assign this license because it is invalid. Use
the Get-MsolAccountSku cmdlet to retrieve a list of valid licenses.
At line:1 char:20

 

PS C:\Windows\system32> Set-MsolUserLicense -UserPrincipalName florian.cloudtest
@domain.com -licenseoptions $DisableSStatus

 

This WORKS! But it only disables the plans defined in $DisableSStatus.

 

Can someone tell me how to add specific plans?

 

PS C:\Windows\system32> Set-MsolUserLicense -UserPrincipalName florian.cloudtest
@domain.com -addlicenses domain:ENTERPRISEPACK -licenseoptions $DisableSStatus

 

Fails as well! Same error. But only when the user already is licensed.

 

  • Post Points: 20
Verified Answer
  • Hi Hoetz,

    Thanks for your post here.

    Based on your description, I understand that when you assign license to users through PowerShell you encounter an error message " Set-MsolUserLicense : Unable to assign this license because it is invalid. Use the Get-MsolAccountSku cmdlet to retrieve a list of valid licenses."

    Based on my understanding, the two parameters "-LicesnseOptions" and "-AddLicenses" are not able to be used at the same time. If you want to apply a custom license package to the user's mailbox, you can use "-LicesnseOptions", and if you want to assign a license to a user, you can choose "-AddLicenses". Please refer to the steps below to achieve this:

    1. Connect Windows PowerShell to the Service

    onlinehelp.microsoft.com/.../2b09b6a8-ad7e-446f-b7f0-273856beed70

    2. After connecting to your Office 365 service, run the following command to get the accountskuID:

    Get-MsolAccountSku

    3. After getting your accountskuID, you could run the command below to assign the user license:

    Set-MsolUserLicense -UserPrincipalName $sUser@$TenantDomain -AddLicenses "***:ENTERPRISEPACK"

    Please note to change $sUser@$TenantDomain to be the user's SMTP address and change the ***ENTERPRISEPACK to be your accountskuID.

    You also can refer to the link below to get more information about assigning license to user through PowerShell:

    community.office365.com/.../granular-license-assignment-from-powershell.aspx

    Alternatively, we can also manage user's licenses with UI interface in the Microsoft Online Portal(MOP). Please refer to the detailed steps below:

    1.Logon to Office 365 portal

    2. Click on Adminat the top of the Admin page.

    3.Click Users under Management section in the navigation pane at the left

    4.Select the user who you want to assign a license, click edit

    5.Under Licenses, you can assign license to specific service.

    6. Click save and check the result.

    You can get more information about user license by referring to the link below:

    For Office 365 subscription of small and business:

    onlinehelp.microsoft.com/.../gg570298.aspx

    For Office 365 subscription of enterprise:

    onlinehelp.microsoft.com/.../gg570315.aspx

    Thanks,
    Linda Wang

    • Top 75 Contributor
    • Post Points: 0
All Replies
Page 1 of 1 (4 items)