How to Reset a Active Directory password using Powershell

Microsoft has conveniently provided us with PowerShell to carry out Active Directory-related tasks using the Active Directory Powershell Module as part of the RSAT tool. Using this command, you can manage many aspects of the Active Directory including the reset of the Active Directory password using Set-ADAccountPassword command.

Before you reset an AD User Password, you have to have two required pieces of information ready – the AD Users identity and the required password. These are the variables required when using the command Set-ADAccountPassword.

Now that you have the necessary information required to run the command, use the following steps to carry out the reset:

  1. First, create the secure string representation of the new password by running the command below in PowerShell. This command will convert the plain text password into a secure string and save it to a variable.
$NewPwd = ConvertTo-SecureString "MyPassword@123" -AsPlainText -Force
  1. Next, reset the AD user’s password by running the Set-ADAccountPassword command below. The -Identity parameter accepts the AD user’s ID, while the -NewPasswordparameter accepts the secure password object you created in the previous step. Lastly, the -Reset switch instructs the cmdlet to reset the user’s password.
Set-ADAccountPassword -Identity ADUser -NewPassword $NewPwd -Reset

Unless there was an error during the password reset process, the command you executed will not show any output on the screen.

Leave a Reply

Your email address will not be published. Required fields are marked *

PHP Code Snippets Powered By : XYZScripts.com