Forum Discussion

AdamAtTheMuseum's avatar
AdamAtTheMuseum
Copper Contributor
May 23, 2023

MS Microsoft Graph PowerShell SDK to assign licenses in bulk from a csv file

Hello

I have a .csv file with over 400 users in it in the form of the email address of each user.

I need to assign a Microsoft 365 license to each user as a one-off process. They currently have three separate licenses, Windows 10, EMS and Office 365.

I used to be able to use msol cmdlets but these have been deprecated and I can no longer use them.

the cmdlets were Get-Content 

then

ForEach

Set-MsolUserLicence

etc etc...

 

But now I have to use MS Graph Powershell SDK (which I have installed) and for the life of me I cannot work out how to do this.

 

I can see its Set-MgUserLicense -AddLicenses but all the examples I see are to set a licence to just one user...

I want to read my list of users and do a For-Each on them but I cant see how I can do that in Microsoft Graph Powershell SDK.

Can anyone help?

 

 

Resources