Quantcast
Viewing all articles
Browse latest Browse all 21975

Add users to Office365 with Powershell and a CSV file

For some reason I cant get this to work.

I've been using this script for the last two years and now it wont work and I cant figure out why.  Can anyone see my mistake?

Import-Csv C:\Users\Me\Desktop\Year7.csv | foreach {New-MsolUser -DisplayName $_.DisplayName -UserPrincipalName $_.UPN -Password  $_.Password  - UsageLocation  GB}

Here's the error

New-MsolUser : A positional parameter cannot be found that accepts argument
'-'.
At line:1 char:63
+ Import-Csv C:\Users\Me\Desktop\Year7.csv | foreach {New-MsolUser
-Disp ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~


Viewing all articles
Browse latest Browse all 21975

Trending Articles