License & Subscription Issues

Disable Microsoft Teams for Multiple Users with PowerShell

Khadija KhanKhadija Khan Nov 25, 2026 868 views

Question details

An administrator needs to disable the Microsoft Teams service plan for multiple users listed in a file.

Disable Microsoft Teams for Multiple Users with PowerShell
Product
Microsoft Teams and Microsoft 365 licensing
Device & OS
not provided
Scenario
Apply a license service-plan change to more than 50 selected users without editing each license manually.
Observed behavior
A legacy New-MsolLicenseOptions command reports a missing DisabledPlans parameter when the administrator tries to prepare the license change.
Before you start

Prepare a text file with one user principal name (UPN) per line, or a CSV with a UPN column. Sign in with an account authorized to manage licenses, identify the target subscription and Teams service plan, and check whether users receive the license directly or through a group.

Solution 1Recommended

Disable the Teams service plan with Microsoft Graph PowerShell

Use the supported Microsoft Graph approach to update a directly assigned license for each user while retaining its other disabled plans.

The older MSOnline module has been retired. Microsoft Graph PowerShell replaces New-MsolLicenseOptions and Set-MsolUserLicense for this task.

The script updates one subscription SKU and skips users who do not have that SKU directly assigned. Group-based assignments must be changed through the licensing group.

1
Install and connect to Microsoft Graph

In PowerShell, run Install-Module Microsoft.Graph -Scope CurrentUser if needed. Then run Connect-MgGraph -Scopes 'LicenseAssignment.ReadWrite.All','User.Read.All','Organization.Read.All' and sign in with an appropriately authorized administrator account, such as a License Administrator.

2
Find the SKU and Teams plan

Run Get-MgSubscribedSku -All | Select-Object SkuPartNumber,SkuId to find the subscription. Then run (Get-MgSubscribedSku -All | Where-Object SkuPartNumber -eq '<SkuPartNumber>').ServicePlans | Select-Object ServicePlanName,ServicePlanId and identify the Teams plan in that SKU.

3
Run the license update

Replace the file path, SKU part number, and service-plan name below, then run the script in PowerShell: $Sku = Get-MgSubscribedSku -All | Where-Object SkuPartNumber -eq '<SkuPartNumber>' $Plan = $Sku.ServicePlans | Where-Object ServicePlanName -eq '<TeamsServicePlanName>' if (-not $Sku -or -not $Plan) { throw 'SKU or service plan not found.' } $Users = Get-Content '<FilePath>' | Where-Object { $_.Trim() } foreach ($UPN in $Users) { $User = Get-MgUser -UserId $UPN.Trim() -Property Id,AssignedLicenses,LicenseAssignmentStates $Direct = $User.LicenseAssignmentStates | Where-Object { $_.SkuId -eq $Sku.SkuId -and -not $_.AssignedByGroup } $License = $User.AssignedLicenses | Where-Object { $_.SkuId -eq $Sku.SkuId } if (-not $Direct -or -not $License) { Write-Warning "No direct SKU assignment for $UPN; skipped."; continue } $Disabled = @($License.DisabledPlans) + @($Plan.ServicePlanId) | Select-Object -Unique Set-MgUserLicense -UserId $User.Id -AddLicenses @(@{SkuId = $Sku.SkuId; DisabledPlans = @($Disabled)}) -RemoveLicenses @() }

4
Verify the change

In the Microsoft 365 admin center, open Users > Active users, select a test user, and inspect Licenses and apps. Confirm that Teams is disabled for the intended subscription and check for any licensing errors.

Disable the Teams service plan with Microsoft Graph PowerShell
Check other assignments: A user may still have Teams enabled through another subscription or a group-based license. Service-plan dependencies can also prevent a change, so test with a small set of users first.
Free Microsoft Office alternative

Prepare Your User List with WPS Office

WPS Office is a free, lightweight Microsoft Office alternative with a familiar interface and format compatibility for an easy move between office suites. Use WPS Spreadsheets to review a user list; Microsoft Graph is still required to change Teams licenses.

Review and organize user principal names in a spreadsheetCompatible with Microsoft Excel formats such as XLSXOpen and save CSV files for PowerShell inputFamiliar spreadsheet interface for easy migration
microsoft office alternative - wps office

Frequently Asked Questions

How do I use a CSV instead of a text file?

Give the CSV a column named UPN and replace the Get-Content line with $Users = Import-Csv '<FilePath>' | Select-Object -ExpandProperty UPN.

Why does PowerShell report a missing DisabledPlans argument?

In the legacy New-MsolLicenseOptions command, -DisabledPlans requires a service-plan value after it. Check for an omitted or empty value, then use Microsoft Graph PowerShell because MSOnline has been retired.

Will disabling Teams remove the user's other apps?

The Graph script adds the Teams plan to the SKU's existing disabled-plan list rather than replacing that list. Other apps remain subject to their existing license settings and any service-plan dependencies.

What if the license is assigned through a group?

Change the license settings on the assigning group in the Microsoft Entra admin center. The script skips users without a direct assignment of the selected SKU.

Why might a user still have access to Teams?

The user may have Teams enabled through another SKU or a group assignment. Check all assigned licenses under the user's Licenses and apps settings in the Microsoft 365 admin center.