How to change password using PowerShell on Windows 11

Configurare noua (How To)

Situatie

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.

Solutie

Pasi de urmat
  • Open Start.
  • Search for PowerShell, right-click the top result, and select Run as administrator.
  • Type the following command to list all the available accounts and press Enter:
Get-LocalUser

Get-LocalUser command
  • 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
  • Type the new password for the account and press Enter.
  • 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.
  • Once you complete the steps, sign out and sign back into Windows 11 using the new password.

Change password PowerShell command

Tip solutie

Permanent

Voteaza

(1 din 2 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?