Avatar of nav2567
Flag for United States of America

asked on 

Bulk remove Office 365 license.


I am trying the below script to read a CSV file that contains list of UPNs to bulk remove some Office 365 licenses but it is not successful.  

Would someone please take a look and see if something is missed?


import-csv -path "C:\users.csv" | foreach-object {set-msoluserlicense -userprincipalname $_.userprincipalname -removelicenses $_.license}

CSV file contains
UserPrincipleName       License
jsmith                               ITS007149:EXCHANGESTANDARD
sgolden                            ITS007149:EXCHANGESTANDARD
slee                                   ITS007149:EXCHANGESTANDARD
PowershellMicrosoft 365

Avatar of undefined
Last Comment
Adam Brown

8/22/2022 - Mon