How to Reset Windows Password from the Command Line
To reset a Windows password from the command line, use the command net user [username] [newpassword] in an elevated Command Prompt. If you are locked out of your account, you must boot from a Windows installation media, use the "Sticky Keys" or "Utilman" worka...
To reset a Windows password from the command line, use the command net user [username] [newpassword] in an elevated Command Prompt. If you are locked out of your account, you must boot from a Windows installation media, use the "Sticky Keys" or "Utilman" workaround to access the Command Prompt at the login screen, and then execute the reset command.
Contents
The ability to manage user credentials via the Command Line Interface (CLI) remains one of the most powerful tools in a Windows administrator's arsenal. Whether you are dealing with a forgotten password on a local machine or managing accounts across a networked environment in 2026, understanding the underlying mechanics of the Windows NT user account system is essential. This guide covers the specific procedures for resetting passwords using the Command Prompt (CMD), the prerequisites for success, and the security implications of these methods.
Prerequisites and Technical Requirements
Before attempting to reset a password via the command line, it is vital to understand the environment in which you are working. Windows security has evolved significantly, and by 2026, many systems utilize advanced encryption and cloud-based authentication that may complicate a standard CLI reset.
Local vs. Microsoft Accounts
The net user command is designed to interact directly with the Security Accounts Manager (SAM) database. This works flawlessly for local accounts. However, if the user is logging in with a Microsoft Account (linked to an email address), the command line can only change the local cached password or enable the hidden Administrator account. It cannot synchronize a new password back to Microsoft’s cloud servers. For Microsoft accounts, the preferred method remains the web-based password recovery portal, though the CLI can still be used to regain local access via an alternative admin account.
Administrative Privileges
To execute password changes, the Command Prompt must be running with Elevated Privileges (Run as Administrator). If you are already logged into an account with administrative rights, this is straightforward. If you are locked out of the only account on the system, you will need to bypass the standard operating environment using Windows Recovery Environment (WinRE) or external installation media to gain the necessary system-level access.
BitLocker and Device Encryption
As of 2026, most modern Windows laptops and desktops ship with BitLocker or Device Encryption enabled by default. If the system drive is encrypted, the command line will not be able to "see" the SAM database unless you provide the 48-digit BitLocker Recovery Key first. Ensure you have this key available before attempting to modify system files from an external boot source.
Method 1: Resetting a Password While Logged In
If you have access to an administrator account and need to reset the password for another user (or your own), the process is instantaneous. This is common in workplace environments where a technician needs to assist a user, or on a shared family computer.
Step-by-Step Procedure
- Open an Elevated Command Prompt: Click the Start menu, type
cmd, right-click the result, and select Run as Administrator. - Identify the Target Username: Type
net userand press Enter. This will list all accounts registered on the machine. Note the exact spelling of the username you wish to modify. - Execute the Reset: Type the following command:
net user "UserName" NewPassword123Replace "UserName" with the actual account name and "NewPassword123" with the desired password. - Confirm Success: The CLI should return the message: "The command completed successfully."
If the username contains spaces (e.g., John Doe), you must enclose it in quotation marks. If you wish to reset the password without it being visible on the screen (to prevent "shoulder surfing"), you can type net user "UserName" *. Windows will then prompt you to type the password twice without displaying the characters.
Method 2: Resetting a Password When Locked Out
When you are completely locked out of Windows, you cannot simply open the Command Prompt. You must use a workaround known as the "Utilman Hack" or the "Sticky Keys Trick." This involves replacing a legitimate Windows accessibility tool with the Command Prompt executable, allowing you to trigger the CLI from the login screen.
Step 1: Boot into Windows Recovery Media
Insert a Windows 11 (or current version) installation USB drive and boot from it. Instead of clicking "Install Now," select Repair your computer in the bottom-left corner. Navigate to Troubleshoot > Advanced Options > Command Prompt.
Step 2: Locate the Windows Directory
In the recovery environment, the drive letters are often shifted. You need to find the drive where Windows is installed (usually C: or D:). Test by typing C: and then dir. If you see the "Windows" folder, you are in the right place.
Step 3: Replace the Utility Manager
Type the following commands sequence to back up the Utility Manager and replace it with CMD:
copy c:\windows\system32\utilman.exe c:\(Backs up the file to the root of C:)copy c:\windows\system32\cmd.exe c:\windows\system32\utilman.exe- Type
yto confirm the overwrite.
Step 4: Reset the Password at the Login Screen
Restart the computer and boot into your normal Windows installation. At the login screen, click the Accessibility icon (the human figure or dial icon in the bottom right). Because we replaced the accessibility tool with cmd.exe, a Command Prompt window will open with SYSTEM privileges.
Now, use the standard command:
net user "YourUsername" YourNewPassword
Close the Command Prompt and log in with your new credentials. Once back in, it is highly recommended to restore the original utilman.exe to maintain system integrity.
Comparison of Password Recovery Methods
The following table summarizes the different approaches to password management via the command line and their respective requirements.
| Method | Primary Use Case | Ease of Use | Requires External Media? | Works on MS Accounts? |
|---|---|---|---|---|
| Direct Net User | User is already an Admin | High | No | Partially (Local only) |
| Utilman/CMD Swap | Forgotten password / Locked out | Moderate | Yes | No (Local only) |
| Enable Hidden Admin | Recovery of corrupted profiles | Moderate | Yes | Yes (Creates new access) |
| PowerShell Reset | Automation / Scripting | High | No | Yes (via WMI/CIM) |
Managing the Built-in Administrator Account
In some recovery scenarios, you may not want to change a user's password but instead want to gain access to the system through the hidden "Administrator" account. This account is disabled by default in Windows to prevent unauthorized access, but it can be toggled via the command line.
To enable it, type:
net user administrator /active:yes
If the account already has a password that you don't know, you can clear it or change it simultaneously:
net user administrator * /active:yes
Once enabled, this account appears on the login screen as an option. It has full, unrestricted access to the machine. After fixing your primary account, you should always disable this account for security reasons by using the /active:no flag.
Troubleshooting Common Command Line Errors
Even with the correct syntax, you may encounter errors when attempting a password reset. These usually stem from security permissions or system state.
- System Error 5 - Access Denied: This occurs when the Command Prompt is not running as an Administrator. Even if you are an admin user, you must explicitly choose "Run as Administrator" to satisfy User Account Control (UAC).
- The user name could not be found: Ensure you are using the "Short Name" of the account. This is the name displayed in the
C:\Users\folder, which may differ from the "Full Name" shown on the welcome screen. - The password does not meet password policy requirements: This happens on Windows Pro or Enterprise versions joined to a domain. If the organization requires a specific length or complexity (numbers, symbols), the
net usercommand will fail unless the new password meets those criteria.
Security Considerations for 2026
While these command-line techniques are invaluable for recovery, they highlight a potential security vulnerability. If someone has physical access to your computer, they can use these same steps to gain access to your files.
To protect yourself against these CLI-based attacks:
- Enable BitLocker: This prevents anyone from modifying the
utilman.exeorcmd.exefiles from an external boot drive. Without the recovery key, the drive remains an encrypted "black box." - Set a BIOS/UEFI Password: This prevents unauthorized users from changing the boot order to start from a USB recovery drive.
- Use Passwordless Authentication: By 2026, Microsoft has moved heavily toward Windows Hello (biometrics) and FIDO2 security keys. These methods do not rely on traditional passwords stored in the SAM database, making them much harder to "reset" via simple CLI commands.
FAQ
Can I reset a Windows password with PowerShell?
Yes. PowerShell offers more robust tools for account management. You can use the Set-LocalUser cmdlet. For example: $Password = Read-Host -AsSecureString followed by Set-LocalUser -Name "UserName" -Password $Password. This is often preferred in 2026 for its better integration with modern security protocols and scripting.
Does the command line password reset delete my files?
No. Using net user to change a password only modifies the authentication hash in the SAM database. Your documents, photos, and applications remain untouched. However, if you use EFS (Encrypting File System) to encrypt specific folders, you will lose access to those folders because the encryption key is tied to the original password.
What if I am on a Work Domain?
If your computer is part of an Active Directory or Azure AD domain, the net user command will likely only affect the local machine account. To reset a domain password, the command must be run on a Domain Controller using net user [username] [password] /domain, provided you have Domain Admin privileges.
Why is the "Accessibility" trick not working?
Microsoft occasionally releases patches that check the file integrity of utilman.exe or sethc.exe during the boot process. If Windows detects the file has been replaced, it may attempt to "self-heal" or block execution. Additionally, if "Windows Defender System Guard" is active, it may prevent these system-level file swaps.
Recommendations for Account Recovery
If you find yourself frequently needing to reset passwords, consider creating a Password Reset Disk (a legacy but functional tool) or ensuring your Microsoft Account recovery information (phone and secondary email) is up to date. For professional environments, implementing a LAPS (Local Administrator Password Solution) is the gold standard. LAPS automatically manages and rotates local administrator passwords across all machines in a network, storing them securely in Active Directory, which can then be retrieved by authorized IT staff via the command line or a management console without resorting to "hacks."