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
Who is Participating?
Adam BrownConnect With a Mentor Sr Solutions ArchitectCommented:
Your UserPrincipalName in the csv excludes the domain. UPN is the full user login of user@domain.com. Normally this would be the user's email.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.