Forum Discussion
Powershell to disable Teams for all users
- Jun 01, 2017It seems the license that you already applied to the user and the one we are trying to apply now are different, due to this error is thrown. You can also use the below tool from Microsoft TechNet Gallery.
https://gallery.technet.microsoft.com/Office365-License-cfd9489c
Once you open the tool,
select all user -->right click-->manage License-->remove license or plan -->expand your license and select teams1 --> click update
$LicenseOptions = New-MsolLicenseOptions -AccountSkuId $license -DisabledPlans TEAMS1
$AllLicensed = Get-MsolUser -All | where {$_.isLicensed -eq $true}; $AllLicensed | foreach {Set-MsolUserLicense -LicenseOptions $LicenseOptions }
cmdlet Set-MsolUserLicense at command pipeline position 1
Supply values for the following parameters:
ObjectId:
What is wrong here?
- May 31, 2017
Sorry, the objectid was missing, please check the below updated script.
$LicenseOptions = New-MsolLicenseOptions -AccountSkuId $license -DisabledPlans TEAMS1
$AllLicensed = Get-MsolUser -All | where {$_.isLicensed -eq $true};$AllLicensed | foreach {Set-MsolUserLicense -ObjectId $_.ObjectId -LicenseOptions $LicenseOptions }
- Harry DuboisJun 01, 2017Brass ContributorAlso same result:
Set-MsolUserLicense : Unable to assign this license because the license options
are invalid.
At line:1 char:92- Jun 01, 2017It seems the license that you already applied to the user and the one we are trying to apply now are different, due to this error is thrown. You can also use the below tool from Microsoft TechNet Gallery.
https://gallery.technet.microsoft.com/Office365-License-cfd9489c
Once you open the tool,
select all user -->right click-->manage License-->remove license or plan -->expand your license and select teams1 --> click update
- Laurent SchoenaersMay 31, 2017Copper Contributor
Did you try something like the following already?
$LicenseOptions = New-MsolLicenseOptions -AccountSkuId $license -DisabledPlans TEAMS1
$AllLicensed = Get-MsolUser -All | where {$_.isLicensed -eq $true};
$AllLicensed | foreach {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -LicenseOptions $LicenseOptions }
Where "tenant" is the name of your tenant.
- Harry DuboisJun 01, 2017Brass Contributor
Same result:
Set-MsolUserLicense : Unable to assign this license because the license options
are invalid.
At line:1 char:25