- Azure Active Directory Module for Windows PowerShell (32-bit version)
- Azure Active Directory Module for Windows PowerShell (64-bit version)
To set the passwords for multiple users, I used a single column CSV file with the usernames to be reset. The script is shown below.
To break it down, The crux of what we are doing relies around this command (shown with the syntax to change the password for a single user). The ForceChangePassword $false means the password doesn't have to be reset upon first login.
Set-MsolUserPassword -UserPrincipalName email@example.com -NewPassword xxxx -ForceChangePassword $false
- $msolcred = Get-Credential - This will prompt you for credentials, for which you would supply the Office 365 administrator username/password.
- Connect-MsolService -credential $msolcred - Connects to the service
- $csvFile = "C:\_Delete\output.csv" - Defines the location of the CSV file in $csvFile
- $csv = Import-Csv $csvFile -Header UPN - Import the CSV file list and store it as $csv, and set the header for column one
- A foreach loop is then used to iterate through each line in the imported CSV file executing the password set command using the UPN from the CSV as the -UserPrincipalName argument.
Reference: Manage Azure AD using Windows PowerShell