Skip to content

Instantly share code, notes, and snippets.

@beckettkev
Created March 7, 2019 13:43
Show Gist options
  • Save beckettkev/da5f86207f2c1fb4b7c8adb8cc056f72 to your computer and use it in GitHub Desktop.
Save beckettkev/da5f86207f2c1fb4b7c8adb8cc056f72 to your computer and use it in GitHub Desktop.
Creates a bunch of users in a tenant, given a csv file full of users
#Install-Module MSOnline
$users = ipcsv ./CreateDemoUsers.csv;
Connect-MsolService
$users | ForEach-Object {
Write-Host "Adding $($_.DisplayName)..." -foregroundcolor green;
$user = $_.psobject.properties | % { $ht = @{} } { $ht[$_.Name] = $_.Value } { $ht };
$user.PasswordNeverExpires = $true;
New-MsolUser @user;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment