Skip to content

Instantly share code, notes, and snippets.

@wim-beck
Last active March 15, 2021 02:03
Show Gist options
  • Save wim-beck/c402e54b47ab852701be800af6206073 to your computer and use it in GitHub Desktop.
Save wim-beck/c402e54b47ab852701be800af6206073 to your computer and use it in GitHub Desktop.
Reset AD password
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")
@wim-beck
Copy link
Author

wim-beck commented Mar 2, 2017

Similar call using ADSI: ([adsi]'WinNT://domain/username,user').ChangePassword('oldpassword','newpassword')
Source: https://gist.github.com/jstangroome/3087453

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment