New-MsolUser

Source

Microsoft Docs

Prerequisite

Install PowerShell the Azure Active Directory

Returns all the SKUs for a company.

Get-MsolAccountSku

Download

New-MsolUser.csv

New-MsolUser.xlsx

FirstName,LastName,DisplayName,UserPrincipalName,UsageLocation,AccountSkuId,MobilePhone,PhoneNumber,Title,Department,StreetAddress,PostalCode,City,Office

Edit in Excel save as CSV UFT-8 > Open in NotePad++ and replace ; with ,

New-MsolUser.ps1

Import-Csv -Path "C:\Knowledgebase\New-MsolUser.csv" | ForEach {New-MsolUser -FirstName $_.FirstName -LastName $_.LastName -DisplayName $_.DisplayName -UserPrincipalName $_.UserPrincipalName -UsageLocation $_.UsageLocation -LicenseAssignment $_.AccountSkuId -MobilePhone $_.MobilePhone -PhoneNumber $_.PhoneNumber -Title $_.Title -Department $_.Department -StreetAddress $_.StreetAddress -PostalCode $_.PostalCode -City $_.City -Office $_.Office } | Export-Csv -Path "C:\Knowledgebase\Results.csv"

NewPassword.ps1

Import-Csv -Path "C:\Knowledgebase\New-MsolUser.csv" | ForEach {Set-MsolUserPassword -UserPrincipalName $_.UserPrincipalName -NewPassword "Temporary123!" -ForceChangePassword:$false}

StrongPasswordRequired_false.ps1

Import-Csv -Path "C:\Knowledgebase\New-MsolUser.csv" | ForEach {Set-MsolUser -UserPrincipalName $_.UserPrincipalName -StrongPasswordRequired $false}
Import-Csv -Path C:\Knowledgebase\New-MsolUser.csv -delimiter ';'