Table of Contents
On a Windows 10 PC you administer, use Set-LocalUser to set a new password for a local account. For a routine change to your own account when you know the old password, Settings > Accounts > Sign-in options is usually easier. A Microsoft account, work account, and Windows Hello PIN have separate procedures.
Confirm you are changing the right account
Open Windows PowerShell as administrator. On 64-bit Windows, use the 64-bit app. The LocalAccounts module is unavailable in the 32-bit PowerShell process on a 64-bit system. Run this to list accounts and their status:
Get-LocalUser | Select-Object Name, EnabledCheck the exact local account name. On a shared or managed PC, change another user’s password only when you have authority and have followed the applicable recovery procedure. An administrative reset can affect access to credentials and files encrypted by that user.



Enter the new password at a secure prompt
$account = Get-LocalUser -Name 'AccountName' -ErrorAction Stop
$password = Read-Host 'Enter the new password' -AsSecureString
Set-LocalUser -InputObject $account -Password $password -ErrorAction Stop
Remove-Variable passwordReplace AccountName before running the commands. At the prompt, type the new password and press Enter. Enter it at the prompt instead of writing it directly into the command or saving it in a script. If PowerShell reports a password policy error, choose a password that meets the displayed requirements. See Microsoft’s Set-LocalUser reference.




Verify the new password
Save open work and use Switch user to test the affected account, or sign out when you have confirmed another recovery path. Select the password sign-in option if Windows shows a PIN field first. A restart is generally unnecessary. See the Windows sign-in settings guide or what to do if the password expired.
Reader Comments 0
Sign in with email or Google to join the discussion.