Reset computer account password command line

description title ms.author author manager ms.date ms.topic ms.assetid

Learn more about: AD Forest Recovery - Resetting the computer account on the DC

AD Forest Recovery - Resetting the computer account on the DC

4e1a6070-df0a-4dfe-8773-899a010bfabd

Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012 and 2012 R2, Windows Server 2008 and 2008 R2

Use the following procedure to reset the computer account password of the DC.

To reset the computer account password of the domain controller

  1. At a command prompt, type the following command, and then press ENTER:

  2. Use the syntax that this command provides for using the Netdom command-line tool to reset the computer account password, for example:

    netdom resetpwd /server:domain controller name /userD:administrator /passwordd:*

    Where domain controller name is the local DC that you are recovering.

    [!NOTE] You should run this command twice.

Next Steps

  • AD Forest Recovery Guide
  • AD Forest Recovery - Procedures


Page 2

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

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.

If you’re an IT pro and struggling with password reset issues in Active Directory, be sure to check out Specops’ uReset tool.

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! Not seeing the video? Make sure your ad blocker is disabled.

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:

  1. 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.

Reset computer account password command line
The user adambertram is logged in.

3. Now type net user followed by your logged-in user account.

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 computer account password command line
Inspecting the Local Group Memberships of the logged-in user account

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 [email protected].

net user adambertram [email protected]

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:

  1. 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 "[email protected]" -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:

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.

Reset computer account password command line
Restarting Windows 10 in 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.

Reset computer account password command line
Navigating to Advanced Options in safe mode.

5. The Advanced Options screen displays several options to choose from. Click on Startup Settings.

Reset computer account password command line
Selecting Startup Settings in the Advanced Options menu.

6. On the Startup Settings screen, select the Restart button. Once restarted, Windows 10 will be in safe mode.

Reset computer account password command line
Startup Settings options prior to restarting in Safe Mode.

7. After restarting, the Startup Settings screen will list several options to choose from. Press 4 to restart into safe mode.

Reset computer account password command line
Advanced boot options: Press 6 or F6

8. After restarting again, you should now see a Command Prompt opens with elevated privileges (Administrator:) rather than the normal Windows 10 desktop.

Reset computer account password command line
Running the command prompt in safe mode

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 [email protected]

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.

  1. Insert the recovery media and restart the computer. Once Windows reboots, the Windows setup screen will appear.

Reset computer account password command line
Windows 10 install screen

2. Press Shift + F10 to open a Command Prompt.

Reset computer account password command line
Reset Windows 10 Password via the 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.

If you’re looking for an easier and automated solution, check out Specops’ uReset tool.

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.

Reset computer account password command line
Swapping Ease of Use with cmd.exe

6. Now that you’re in a command prompt again, simply change the password with net user as before.

net user adambertram [email protected]

7. Now restart Windows 10 and login with the user account with the new password!