
QuickTip – PowerShell – Script to Reset AD User’s Password
If you manage systems and services that allow users access with a their Active Directory username and password, you have probably dealt with password reset issues. Sometimes, you are setting up new systems or services with a test account. Here is an easy PowerShell “script” to reset an AD user’s password.
$sAMAccountName = Read-Host -Prompt "sAMAccountName" $SecurePW = Read-Host -Prompt "Enter a Password" -AsSecureString Set-ADAccountPassword -Identity $sAMAccountName -Reset -NewPassword $SecurePW
The first line prompts you to enter the sAMAccount name of the user. The second, allows you to enter in the password a single time. The third, executes the change to the specified account.