Have you ever gotten locked out of your Windows 10 computer or had to figure out how to change a user password like the administrator password? Windows 10 offers several approaches to reset Windows user passwords if you know the current password or not. One of the easiest methods is to reset Windows 10 password via the command prompt.
Today’s sponsor is Tower, a beautiful, native Git client designed to make Git easy (and actually enjoyable!) to use. Tower is available for both Mac and Windows, and this week, you can get it at a very special price!
In this article, you will learn many different ways to reset Windows 10 passwords via the command prompt and you’ll even see how to get back into a locked out Windows computer.
Not a reader? Watch this related video tutorial!Related: How to Rotate Windows Admin Passwords with Microsoft LAPS
Prerequisites
This tutorial is going to get hands-on and go over the steps to reset Windows 10 password via the command prompt. Other than a Windows 10 computer, you will also need the Windows 10 recovery media if you can’t log in to the PC. You can find information here on how to set up recovery media.
This tutorial will use Windows 10 Build 1909 for all examples and will be working on a computer that is not in an Active Directory domain.
Reset Windows 10 Password While Logged In
If you need to reset a password, chances are you’ll be in one of two states; logged-in and locked out. Let’s first cover how you can reset a password while logged into Windows with an administrative user account.
Verifying Reset Privileges
To reset a password while logged into Windows 10, you must have permission to do so. Although you could apply granular permission to reset a password, this tutorial will take the easy route and require a user to be in the Administrators group.
To confirm the account you’re logged in with is a member of the Administrators group:
- Click on the Start menu and type cmd, to open the command prompt window.
Be sure to right-click on cmd and run the command prompt as administrator so you have the rights to make changes.
2. With the Command Prompt window open, type whoami
to get the logged on user. The string before the \
is the name of the computer.
3. Now type net user
followed by your logged-in user account.
net user adambertram
The net user command is a handy command in nearly all Windows versions that will pull information about local user accounts, disable and enable user accounts and reset passwords.
You’ll see a lot of output but the information you’re looking for is at the bottom as shown below. You can see that the adambertram local account is part of the Administrators group.
Reset Windows 10 Password via the Command Prompt
Once you’ve confirmed your logged-in account has permission to reset the password, you can now reset the password. To do that:
With the Command Prompt still open, type net user
followed by the user account and the new password. The command below is changing the local adambertram user account’s password to P@ssw0rd1.
net user adambertram P@ssw0rd1
Once complete, you can now login with the adambertram account with the new password!
Resetting a User Password via PowerShell
The more “modern” way to reset a Windows 10 user password is to use PowerShell. PowerShell is a shell that’s available in all Windows operating system starting in Windows 7.
To reset a user password via PowerShell:
- Click on the Start menu, type in ‘powershell’ and open Windows PowerShell as administrator.
Related: How to Run PowerShell as Administrator
With PowerShell open, you’ll now need to define the new password but also convert it to a secure string. A secure string is one way PowerShell ensures passwords aren’t stored in plain text. This step is enclosed in parentheses below.
The Set-LocalUser
cmdlet is the command that actually changes the password.
Set-LocalUser -Name adambertram -Password (ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force)
Resetting a Locked Out Windows 10 Password (Safe Mode)
Changing a password, as you’ve seen above, is a breeze if you can’t actually log into the computer. But what if you’re completely locked out and can’t log in at all? In that case, you’re not completely out of luck but you’ve got some extra work to do!
To reset a user password while not logged in, you’ve got two options; using Windows 10 safe mode and recovery media. Let’s cover each one now starting with safe mode.
Safe Mode is a Windows 10 troubleshooting tool that restarts the PC in a basic state using a limited set of files and drivers.
You can use safe mode to access the command prompt without loading the full operating system bypassing the login screen.
Getting into Safe Mode
First up, you need to get into safe mode. To do that:
- Log out of Windows 10.
From the main login screen, press and hold the Shift key while clicking Restart as shown below. Once restarted, Windows 10 will be at a spot to tell it you need to boot into safe mode.
3. From the Advanced Boot Options screen, click on Troubleshoot. The Troubleshoot screen is a place in safe mode where you can fix some bootup and other Windows 10 problems.
4. While on the Troubleshoot screen, select Advanced Options.
5. The Advanced Options screen displays several options to choose from. Click on Startup Settings.
6. On the Startup Settings screen, select the Restart button. Once restarted, Windows 10 will be in safe mode.
7. After restarting, the Startup Settings screen will list several options to choose from. Press 4 to restart into safe mode.
8. After restarting again, you should now see a Command Prompt opens with elevated privileges (Administrator:) rather than the normal Windows 10 desktop.
9. Once you have the Command Prompt open in safe mode, the only thing left to do is use net user
to reset the password for the user account.
net user adambertram P@ssw0rd1
Resetting a Locked Out Windows 10 Password (Recovery Media)
If you cannot reboot into safe mode, you can also use the recovery media to change user account passwords. Doing so requires you to copy cmd.exe to the local drive and change the password using the same methods as above.
Let’s step through how to make it happen.
To use this method, you must have already created recovery media probably on a USB stick or a Windows 10 installation disk.
- Insert the recovery media and restart the computer. Once Windows reboots, the Windows setup screen will appear.
2. Press Shift + F10 to open a Command Prompt.
3. In the Command Prompt window run the following two lines. These lines essentially overwrite a file called utilman.exe (Utility Manager) on the Windows 10 sign-in screen located in C:\Windows\system32 with cmd.exe.
Stop struggling with password reset calls and account lockouts in Active Directory. Get a FREE trial of Specops uReset.
move c:\windows\system32\utilman.exe c:\
copy x:\windows\system32\cmd.exe c:\windows\system32\utilman.exe
4. Now, remove the installation disk or the recovery media and restart the computer again.
5. Once the Windows 10 login screen comes up on the Windows 10 sign-in screen tap the Utility Manager icon found on the bottom-right corner to open the command prompt as shown below.
6. Now that you’re in a command prompt again, simply change the password with net user
as before.
net user adambertram P@ssw0rd1
7. Now restart Windows 10 and login with the user account with the new password!