Category filter
Script to Clear Password on Windows
Users tend to forget their passwords from time to time. The process of individually removing/resetting passwords for users puts IT departments in a difficult situation. Fortunately, Hexnode provides a viable solution, enabling users to remove/reset their passwords by
executing custom scripts.
Batch script
Reset the password for the local computer
1 |
wmic useraccount where name='userid' set PasswordRequired=false |
This command resets the password for the local computer being used. The ‘userid’ indicates the local user account from which the password should be cleared.
Powershell script
Reset the password for the local computer
1 |
Reset-ComputerMachinePassword |
This command resets the computer password for the local account. The command runs with the credentials of the user currently logged in, i.e, the password of the currently logged in user will be cleared.
Reset the password for the local computer by using a specified domain controller
1 |
Reset-ComputerMachinePassword -Server "DC01" -Credential Domain01\Admin01 |
This command resets the computer password of the local computer by using the DC01 domain controller. It uses the Credential parameter to specify a user account that has permission to reset a computer password in the domain.
Reset the password on a remote computer
1 2 |
$cred = Get-Credential Invoke-Command -ComputerName "Server01" -ScriptBlock {Reset-ComputerMachinePassword -Credential $using:cred} |
This command uses the Invoke-Command cmdlet to run a Reset-ComputerMachinePassword command on the Server01 remote computer.