Last active
March 15, 2021 02:03
-
-
Save wim-beck/c402e54b47ab852701be800af6206073 to your computer and use it in GitHub Desktop.
Reset AD password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param($AccountName) | |
# Reset a pwd, requires reset pwd rights on the obj: | |
Set-AdAccountPassword -Identity $AccountName -Reset -NewPassword (Read-Host -asSecureString "Enter the new password") | |
# Change a pwd, knowing the current password | |
Set-AdAccountPassword -Identity $AccountName -OldPassword (Read-Host -asSecureString "Enter the current password") -NewPassword (Read-Host -asSecureString "Enter the new password") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Similar call using ADSI: ([adsi]'WinNT://domain/username,user').ChangePassword('oldpassword','newpassword')
Source: https://gist.github.com/jstangroome/3087453