Category filter
Script to clear password on Windows
IT admins, from time to time, find themselves clearing/resetting passwords of various Windows devices enrolled in their organization. Such a scenario often arises when the employee forgets their password and needs help logging into their system or when the employee leaves the company without resetting the password themselves. But in a modern work scenario, where employees work with their devices from remote locations and thus are not easily accessible for the IT admin, custom scripts become the viable option to clear passwords. Hexnode helps IT admins deploy these scripts remotely to the endpoints using the Execute Custom Script action.
Batch script
Clear password for a specific user
1 |
net user <username> "" |
This command resets the password for the local computer being used. Replace <username>
with the local user account from which the password should be cleared.
PowerShell script
Clear password for a specific user
1 |
Set-LocalUser -name "username" -Password ([securestring]::new()) |
Replace username
with the name of the local user account from which the password is to be cleared.
For example, to clear the password from the user account ‘John
’ in the Windows device:
Set-LocalUser -name “John" -Password ([securestring]::new())