Change User Or Multiple Users Password Using PowerShell

This article will show how to reset a user or multiple user password using PowerShell.

To change the password, you will need to load the Active Directory module or run the script below from a Domain Controller.

The script below will change the password to one user name test01:

$newPassword = (Read-Host -Prompt "Provide New Password" -AsSecureString)

Set-ADAccountPassword -Identity test01 -NewPassword $newPassword -Reset

You can also use the line below without the prompt and set the password In the cmdlet:

Set-ADAccountPassword test01 -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "p@ssw0rd" -Force)

You can also reset the password for multiple users using a text file as shown below:

$newPassword = (Read-Host -Prompt "Provide New Password" -AsSecureString)

Get-Content C:\Files\users.txt | Set-ADAccountPassword -NewPassword $newPassword -Reset


Posted

in

by