How to change account password using PowerShell on Windows 10

Date:

Share post:


On Windows 10, you can change your local account password using Control Panel, Command Prompt, and PowerShell, and in this guide, you will learn how. 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.

Change account password from PowerShell on Windows 10

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

  1. Open Start on Windows 10.

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

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

    Get-LocalUser

    PowerShell get users 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 to reset its password.

    PowerShell change account password

Once you complete 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 have a Microsoft account, you must follow these steps to change or reset the password. If you want to reset a password from Command Prompt, use this other guide instead. Also, even though this guide focuses on Windows 10, the above steps should work on Windows 8.1 and 7.

We may earn commission for purchases using our links to help keep offering the free content. Privacy policy info.

All content on this site is provided with no warranties, express or implied. Use any information at your own risk. Always backup of your device and files before making any changes. Privacy policy info.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related articles

Amazon to invest up to $4 billion in AI startup Anthropic

Amazon said Monday it has agreed to invest up to $4 billion in AI startup Anthropic as...

Correcto grabs $7M to build out its ‘Grammarly for Spanish’

The generative AI boom has put a spring in the step of Correcto, a Madrid-based language writing...

California governor vetoes bill to ban driverless AV trucks

California Gov. Gavin Newsom vetoed a bill Friday that would have required a human safety operator to...

A conversation with Cruise’s Kyle Vogt, Bird scoops up Spin, and self-driving trucks live to see another day in Cali

The Station is a weekly newsletter dedicated to all things transportation. Sign up here — just click The Station —...