Adding license options to an existing user with Powershell

  • 3 Followers
  • 4 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: 65
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
  • Hi Hoetz,

    How are things going?
    If you have any other questions or concerns, please do not hesitate to contact us. It is always our pleasure to be of assistance.

    Thanks,
    Linda Wang

    • Top 75 Contributor
    • Post Points: 0
  • I was recently faced with a similar challenge.  I needed to enable only one additional option within an assigned license while preserving the disabled state of any other option.  Have a look at the following post for my solution.  RjZ

    blogs.technet.com/.../bulk-enable-office-365-license-option.aspx

     

    • Not Ranked
    • Post Points: 0
    Suggested by
  • Hi,

    I was struggling with this, but I've found that when you create the New-MsolLicenseOptions, the disabled options parameter needs to be a array object, not just a comma separated list, e.g.

    Works when assigning license options:

    $LicOptions = New-MsolLicenseOptions -AccountSkuId "<orgname>:STANDARDWOFFPACK_STUDENT" -DisabledPlans @("SHAREPOINTWAC_EDU","MCOSTANDARD","SHAREPOINTSTANDARD_EDU")

     

    Does not work when assigning license options:

    $LicOptions = New-MsolLicenseOptions -AccountSkuId "<orgname>:STANDARDWOFFPACK_STUDENT" -DisabledPlans SHAREPOINTWAC_EDU, MCOSTANDARD, SHAREPOINTSTANDARD_EDU

     

    The -LicenseOptions parameter for Set-MSOLUserLicense only works if:

    1. Modifying an license already assigned to the user.

    2. Adding the corresponding license in the same command.

     

    E.g.

    The user has STANDARDWOFFPACK_STUDENT assigned:

    PS C:\Users\PeterN.DATACOM> ((get-msoluser -userprincipalname $user).Licenses) | select accountskuid

    AccountSkuId
    ------------
    orgname:STANDARDWOFFPACK_STUDENT
    orgname:OFFICESUBSCRIPTION_STUDENT

     

    Use this to modify the service plans for STANDARDWOFFPACK_STUDENT license:

    Set-MsolUserLicense -UserPrincipalName $user -LicenseOptions $OfficeStdStudentOptions

     

    if the user does not have the the STANDARDWOFFPACK_STUDENT license assigned, the license needs to be added either before assigning the license options, or in the same command

    Set-MsolUserLicense -UserPrincipalName $user -AddLicenses orgname:STANDARDWOFFPACK_STUDENT

    Set-MsolUserLicense -UserPrincipalName $user -LicenseOptions $OfficeStdStudentOptions

    Or

    Set-MsolUserLicense -UserPrincipalName $user -AddLicenses orgname:STANDARDWOFFPACK_STUDENT-LicenseOptions $OfficeStdStudentOptions

    I hope this helps answer the question!

    • Not Ranked
    • Post Points: 0
Page 1 of 1 (5 items)