Hi Shivam,
To bulk remove license, please follow the steps below:
- Connect to an Office 365 account:
$UserCredential = Get-Credential
Connect-MsolService -Credential $UserCredential
- Create a .csv file to list all accounts. You can download the example file to see the format and add accounts into it.
- Import the .CSV file to $user
$Users=Import-Csv C:\the path of the .csv file\test.csv
- Remove license:
$Users | ForEach{Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -RemoveLicenses AccountSkuId}
Note: replace AccountSkuId for your license plan. Use Get-MsolAccountSku to get AccountSkuId.
If the issue persists, welcome back with a screenshot about your script.
Regards,
Linda