Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $domain = 'someADDomain.local'
- $userName = 'SomeUser'
- $oldPassword = Read-Host -AsSecureString -Prompt "Enter the account's old password"
- $newPassword = Read-Host -AsSecureString -Prompt "Enter a new password"
- Set-ADAccountPassword -Server $domain -Identity $userName -OldPassword $oldPassword -NewPassword $newPassword
- $Password = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force $oldPassword
- $Credential = New-Object System.Management.Automation.PSCredential ("$domain\$userName", $Password)
- Set-ADAccountPassword -Credential $Credential -Server $domain -Identity $userName -OldPassword $oldPassword -NewPassword $newPassword
- # -----------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement