WiseCleaner Think Tank

Encounter difficult computer problems?
All about maintenance and optimization of your Windows System.

Home > Think Tank > How to Change User Account Password Using Windows PowerShell on Windows 11

How to Change User Account Password Using Windows PowerShell on Windows 11

Sep 6, 2023

For advanced users or IT workers who manage multiple accounts, using Windows PowerShell to change account passwords is very efficient and can save a lot of time. However, you can only change passwords for local accounts using Windows PowerShell. If you want to remove a password from a Microsoft account, you need to change it on the Microsoft website or in the account settings. This article will show you how to change the password in Windows PowerShell using different command prompts. If you're interested, keep reading.

First, you need to open a Windows PowerShell window.

Next, you can choose any method to enter the command to change the account password.

Method1. Using the Set-LocalUser Command

Paste the following command and hit Enter.

Set-LocalUser -Name "Username" -Password (ConvertTo-SecureString -AsPlainText "NewPassword" -Force)

Notice: You need to replace the Username with your real account name and change NewPassword to the new password for the account. For example,

Set-LocalUser -Name "wisecleaner" -Password (ConvertTo-SecureString -AsPlainText "wisecleaner@123" -Force)

Method2. Using the WMI Win32_UserAccount command

Paste the following two commands, hitting Enter after each one.

$user = Get-WmiObject Win32_UserAccount -Filter "Name='<Username>'"

$user.SetPassword("<NewPassword>")

Notice: You need to replace the Username with your real account name and replace NewPassword with the new password that you reset. For example:

$user = Get-WmiObject Win32_UserAccount -Filter "Name='<wisecleaner>'"

$user.SetPassword("<wisecleaner@123>")

Method3. Using Get-LocalUser and Set-LocalUser commands

Type the following command line and click Enter.

Get-LocalUser

Continue typing the following command and click Enter. Enter the new password on the next line.

$Password = Read-Host "Enter new password" –AsSecureString

Next, enter the following two command prompts, hitting Enter after typing each command.

$UserAccount = Get-LocalUser -Name "Username"

$UserAccount | Set-LocalUser -Password $Password

Notice: Please replace the Username with the local account name.

Method4. Using Net User Command

In the PowerShell window, type the following command and hit Enter to change the password.

net user Username NewPassward

Please replace the Username with the local account name and NewPassword with the new account password. For example:

net user wisecleaner wisecleaner@123.

If you want to set up a secure and unbreakable password, you can check out How to Generate Safe and Strong Passwords to protect your account from being stolen by others.

These are the four ways to change your local account password using Windows PowerShell. Using Windows PowerShell to change your password protects your information security and makes life less annoying for forgetting your password. If you have other difficulties with computer use, welcome to visit WiseCleaner.

71