troubleshooting Question

Bulk remove Office 365 license.

Avatar of nav2567
nav2567Flag for United States of America asked on
PowershellMicrosoft 365
1 Comment1 Solution777 ViewsLast Modified:

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
Adam Brown
Cloud Security Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2010

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros