O365 Licensing


I need to check from a CSV a list of users if they are licensed instead of doing it one by one.

I have found a script online but is not working.

Can someone guide me?

This is the script I found I tested it but it is not working because it says the users do not exist although they do and are licensed.

Thank you.
MargaritaSystems AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gopi RajuSystem EngineerCommented:
Just login to the office 365 portal and go to active users, you can see a box "Export" with a down arrow next to it, click on it and you will get the CSV file with all the users and their properties.
Vasil Michev (MVP)Commented:
Assuming you have a CSV file (blabla.csv) with column called UserPrincipalName, the fastest way should be something like this:

$users = (Import-Csv blabla.csv).UserPrincipalName
Get-MsolUser -All | ? {$_.UserPrincipalName -in $users -and $_.isLicensed -eq $true}

Open in new window

It avoids having to loop over all entries in the CSV, however it might get slower against large number of users.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MargaritaSystems AdministratorAuthor Commented:
Vasil so this is comparing to the whole tenant?

I am running it now and it didn't give me any results
MargaritaSystems AdministratorAuthor Commented:
Vasil this worked like a charm I made a mistake in my CSV

Thank you so much !
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Office 365

From novice to tech pro — start learning today.