This powershell script can be used to reset user passwords quickly and force them to change it on their next logon. Copy this script into powerhell ISE and save it as a .ps1 file. When you run the script it will prompt you for the username. You can change the password variable to be whatever you want.
$Identity = read-host "Enter User name"
$password = P455w0rd
Set-adaccountpassword -Identity $Identity -reset -newpassword (ConvertTo-SecureString -AsPlainText $password -Force)
Set-aduser $user -changepasswordatlogon $true
or to statically assign the password use the following script:
Set-adaccountpassword -Identity (read-host "Enter User name") -reset
-NewPassword (Read-Host -AsSecureString "New Password")
No comments:
Post a Comment