Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #A simple Powershell script to reset a target account's Active Directory password
- #Written by Kyle Fossum on 9/22/2017
- #Prompt user for the account name and desired password
- $User = Read-Host -Prompt 'Enter the username'
- $Password = Read-Host -Prompt 'Enter the password'
- $PasswordCheck = Read-Host -Prompt 'Enter it again'
- #Check if entered passwords match, and if so, reset the password and unlock the account
- if ($Password -eq $PasswordCheck)
- {$SecurePassword = ConvertTo-SecureString $Password -AsPlainText -Force
- Set-ADAccountPassword -Reset -NewPassword $SecurePassword -Identity $User
- Unlock-ADAccount -Identity $User
- Write-Host "Success! $User has been reset to $Password"}
- Read-Host -Prompt "Press Enter to exit"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement