Category filter
Script to change password of a user account on Windows 10 devices
Users forgetting their device password is a common scenario for an IT admin. Hexnode lets admins to change the password of users by deploying scripts.
Batch Script
1 |
Net user username password |
E.g., To edit the password of the user, Josh to abc_123,
Net user josh abc_123
Reset the password a specific user
1 2 3 |
net user "<username>" "<password>" Echo ‘password reset’ |
The command resets the password of the user <username> with the specified <password>.
PowerShell Script
1 2 |
$NewPassword = ConvertTo-SecureString "the new password" -AsPlainText –Force Set-LocalUser -Name <name> -Password $NewPassword |
E.g., To edit the password of user, Josh to abc_123,
$NewPassword = ConvertTo-SecureString "abc_123" -AsPlainText –Force
Set-LocalUser -Name Josh -Password $NewPassword
Reset password of a specific user
1 2 3 4 5 6 7 |
$Password = ConvertTo-SecureString "<password>" -AsPlainText -Force $UserAccount = Get-LocalUser -Name "<UserName>" $UserAccount | Set-LocalUser -Password $Password echo 'Password reset' |
You can reset the password of a user account by passing its username and the new password as <UserName> and <password> respectively.