Password update

How to change account password using PowerShell on Windows 10

If you need to reset your local account password, you can also use PowerShell, and in this guide, you'll learn how on Windows 10.

Change Windows 10 account password using PowerShell

On Windows 10, you can change your local account password in a number of ways using Control Panel, Command Prompt, and even using PowerShell.

If you must change or reset your account password because it’s been compromised, or it’s too easy to guess and you want to set a more complex password, you can use a few simple PowerShell commands.

In this guide, you’ll learn the steps to change the current password of your Windows 10 local account using PowerShell.

How to change account password using PowerShell

To change a local account password using PowerShell, use these steps:

  1. Open Start.

  2. Search for PowerShell, right-click the top result, and select Run as administrator.

  3. Type the following command to list all the available accounts and press Enter:

    Get-LocalUser

    PowerShell Get-LocalUser command
    PowerShell Get-LocalUser command
  4. Type the following command to create and store the new password inside of a variable and press Enter:

    $Password = Read-Host "Enter the new password" -AsSecureString
  5. Type the new password for the account and press Enter.

  6. Type the following command and press Enter on each line to apply the new password to the local account:

    $UserAccount = Get-LocalUser -Name "admin"
    $UserAccount | Set-LocalUser -Password $Password

    In the second command, make sure to replace “admin” with the name of the account that you want to reset its password.

    PowerShell commands to change an account password
    PowerShell commands to change an account password

Once you’ve completed the steps, sign out and sign back into your Windows 10 account using the new password.

The instructions outlined above apply to a local account. If you’re using a Microsoft account, you need to follow these steps to change or reset the password.

If you’re looking to reset a password using Command Prompt, then use this other guide.

While this guide focuses on Windows 10, the above steps should also work on Windows 8.1 and Windows 7.