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
.

Disclaimer:


The Sample Scripts provided below are adapted from third-party Open-Source sites.

Batch script

Reset the password for the local computer

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

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

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.

Notes:

  • A domain controller is a server that responds to authentication requests and verifies users on computer networks. A domain controller keeps all data inside a domain organized and secured.
  • DC01 refers to the primary domain controller with which the reset password command is being run. Depending on the number of domains, the value can be changed to DC02, DC03 and so on to specify the domain.

Reset the password on a remote computer

This command uses the Invoke-Command cmdlet to run a Reset-ComputerMachinePassword command on the Server01 remote computer.

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.