Skip to Content
Communication Square LLC Help Center

Bulk Password Reset of office 365 users

Written October 2020. Microsoft changes these admin screens often, so the screenshots below may not match what you see today. The sequence of steps is usually still correct — if something looks wrong, tell us and we'll update it.

Description:

This script is used to reset password of office 365 users using powershell and CSV file.

In the CSV you need to create the following columns:

-UserprincipalName: Email of the user whose password you want to reset

-NewPassword: New password you want to set for the user

-ForceChangePassword: User force to change password on first login

Script 1:

Import-Csv -Path "C:\Users\Awais\Desktop\Drivers.csv" | foreach {

$users = get-msoluser | select userprincipalname,objectid | where {-userprincipalname -like $_.UserPrincipalName }

Set-MsolUserPassword -userPrincipalName $_.UserPrincipalName -NewPassword $_.Password -ForceChangePassword $False }

Script 2:

Import-Csv "C:\Users\Awais\Desktop\APSCBWP Users.csv" | % { Set-MsolUserPassword -userPrincipalName $_.UserPrincipalName -NewPassword $_.Password -ForceChangePassword $True }

Last updated on