Bulk Password Reset of office 365 users

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 }

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us