question

RensSergier-9781 avatar image
0 Votes"
RensSergier-9781 asked MarileeTurscak-MSFT answered

Powershell: Possible to add multiple licences with import csv and -LicenseAssignment paramater?

Hello

I just created my own script to automate some things.
I have just one question that I can't solve:

This is my csv:

UserPrincipalName,DisplayName,Password,UsageLocation,LicenseAssignment
Sandrine@emic.be,Sanne,Voka545464,be,

my command:

addpath = "C:\Users\rens.sergier\Desktop\addusers.csv"

import-csv $addpath | foreach { New-Msoluser -UserPrincipalName $.UserPrincipalName -Displayname $.displayname -Password $.Password -UsageLocation $.UsageLocation -LicenseAssignment $_.LicenseAssignment -ForceChangePassword $false}

If i do it with 1 LicenseSku it worked fine but I want to find a way when it is also possible to assign more than 1 licencse to an user.

I tried with an array in my csv file but that did not work

Can anybody help me?

azure-active-directory
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MarileeTurscak-MSFT avatar image
0 Votes"
MarileeTurscak-MSFT answered

One option would be to assign the licenses to a group and then assign users to that group, or use dynamic group membership.

There is also a sample in this blog post that goes through and creates a custom license SKU, and assigns the licenses in bulk to the users. In this solution the admin disabled the license plans that he didn't want to be available to his users.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.