How to change password using PowerShell on Windows 11

<!–

–>

On Windows 11, you can change the password of a local account using PowerShell commands in addition to using Command Prompt and Control Panel.

Usually, it’s no longer recommended to change the password if it hasn’t been compromised since it could lead to many other problems. However, if the password of your Windows 11 account has been compromised, or you realized it’s easy to guess, you can change it using PowerShell.

In this guide, you will learn the steps to use PowerShell to change the current password of a Windows 11 local account.

Change account password on Windows 11 with PowerShell

To change a local account password with PowerShell command on Windows 11, use these steps:

  1. Open Start.

    .Windows_Software_Technology-Big-343 { display:inline-block; width: 300px; height: 600px; } @media(min-width: 500px) { .Windows_Software_Technology-Big-343 { width: 300px; height: 600px;} }
  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

    Get-LocalUser command

  4. Type the following command to create and store the new password in 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 "tempuser"
    $UserAccount | Set-LocalUser -Password $Password

    In the second command, make sure to replace “tempuser” with the name of the account to reset its password.

    Change password PowerShell command

Once you complete the steps, sign out and sign back into Windows 11 using the new password.

If you have to reset a password using Command Prompt, then use this other guide. Also, even though, this guide focuses on Windows 11, the above steps should also work on Windows 10, Windows 8.1, and Windows 7.

Post a Comment