Office 365 PowerShell Add License

Unable to apply the -LicenseOptions when running the add license to user via script. The script does apply the Enterprise Pack. However, it does not disable plans. In this case I'm trying to disable the Lync online plan. I receive the error " Set-MsolUserLicense : Unable to assign this License because the license options are invalid" I'm attempting to disable Lync online when applying the License. 

$O365Licences = New-MsolLicenseOptions AccountSkuId "xxxx365:ENTERPRISEPACK" -DisabledPlans MSCOSTNADARD



$Licenseuser = get-mailbox -resultsize unlimited |Where-Object {$_.CustomAttribute7 -eq "LicenseMe"} 




Foreach($EachUser in $LicenseUser){
 
 Set-Msoluser -userPrincipalName $Eachuser.userprincipalname -UsageLocation "US"
 Set-MsoluserLicense -userPrincipalName $Eachuser.userprincipalname -AddLicenses $O365Licences 
 
Get-Msoluser -UserPrincipalName $eachuser.UserPrincipalnameSet |Set-MsoluserLicense -LicenseOptions $O365Licences

}
April 21st, 2015 2:24pm

Hi Aaron,

This is the forum to discuss questions and feedback for Microsoft Office client. There is not so much about Office 365 Admin aspect here, I would suggest you to post in the forum of Office 365 Community, where you can get more experienced responses:

http://community.office365.com/en-us/f/default.aspx

The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

Regards,

Ethan Hua
TechNet Community Support

Free Windows Admin Tool Kit Click here and download it now
April 22nd, 2015 1:17am

    

found it.. 

$msolsku = Get-MsolAccountSku | where {$_.accountskuid -eq "xxx:ENTERPRISEPACK"}

    $fulllicopt = New-MsolLicenseOptions -AccountSkuId $msolsku.accountskuid -DisabledPlans MCOSTANDARD

    Set-MsolUser -UserPrincipalName $adu.Userprincipalname -UsageLocation $ccode

April 22nd, 2015 8:51am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics