abhiya
abhiya

Reputation: 1

I have been following to try and write a powershell script to add a new group of local user to windows

$user | ForEach {New-MsolUser -DisplayName $.Display name -FirstName $.First name -LastName $.Last name -UserprincipalName $.User principal name -LicenseAssignment $.Licenses -password WXAqa@123 -Office $.officeaddresss -MobilePhone $_.Phone number -UsageLocation "IN"}

it shows this kind of ERROR: New-MsolUser : A positional parameter cannot be found that accepts argument 'name'. At line:1 char:18

Upvotes: 0

Views: 123

Answers (1)

Michalor
Michalor

Reputation: 377

I think the problem is that the variable names cannot include spaces. I am not sure about the dot at the start as well

Try using

$Display_name

Instead of

$.Display name

Similarly with all other variables of course.

Upvotes: 0

Related Questions