Before understanding the PowerShell password reset process, it is imperative to have a brief idea about what PowerShell is. This will help you understand how things work in the background. Also, knowing about PowerShell may ignite a desire to learn more about it so you can perform other tasks in Windows more conveniently.
In simple words, PowerShell is a command-line interface that allows Windows administrators to automate processes and configure and manage the operating system in a Microsoft-oriented ecosystem. For example, with PowerShell, you can:
- Install and configure apps
- Fix Windows issues
- Run legacy DOS commands
- Schedule and run scripts to automate regular tasks such as data backup, maintenance of the OS, disk defragmentation, etc.
Now that you know how dynamic PowerShell can be, if you know the correct commands, running a few of them to change a password in PowerShell would be child’s play. The process to get the job done is explained in the following section.
Reset Local User Password Using PowerShell in Windows 10/11
To use PowerShell to change the password of a local user, you must launch its instance as an administrator and then use the correct commands. The entire procedure is described below:
Note: A PC running Windows 11 is used here for illustrations.
Launch PowerShell as Administrator
- Click inside the Search bar from the Taskbar
- Type PowerShell in the search input field
- Ensure that the PowerShell app is selected in the search results
- Click Run as administrator from the right pane
- Click Yes on the User Account Control confirmation box
Note: The instance of PowerShell you launch as administrator is technically called an ‘Elevated PowerShell Window.’
Use PowerShell for Password Reset
- Type Get-LocalUser and press Enter (to check the names of user accounts present in Windows)
- Type $NewPass = Read-Host “Please enter a new password” -AsSecureString and press Enter (to accept a password from you and save it in the variable named $NewPass)
- When PowerShell prompts, type a strong password and hit Enter again
- Type $UserAcc = Get-LocalUser -Name “Vivek” and press Enter (to save the target account in the variable named $UserAcc)
Note: Replace Vivek with the name of the account on your PC. For example, if your Windows has a user called John, you must type $UserAcc = Get-LocalUser -Name “John”.
- Type $UserAcc | Set-LocalUser -Password $NewPass and press Enter (to use PowerShell for password reset)
- Close the PowerShell window
- Sign out from your account
- Sign back in with the new password
Bonus: What to Do If You Forgot Windows 10/11 Password
The above method works if you know the password and want to change or reset it. Another scenario where the previous method could be helpful is when you are already signed in but unable to recall the password. In the latter case, while you can go to the ‘Local Users and Groups’ container (available only on the Pro variants of Windows operating systems) from the ‘Computer Management’ snap-in, many professionals consider typing and executing commands comparatively easy.
All good until now.
But what if you forgot the password of your Windows account? This is where a third-party tool called PassFab 4WinKey comes in. Although you will need a working computer for this method, upon successfully completing the process, you will regain access to your Windows computer without losing data.
PassFab 4WinKey is a Windows password reset tool that supports Windows 7 through Windows 11 operating systems and allows you to create password reset media, which could be a USB drive, CD, or DVD.
With the password reset disk, you can skip PowerShell to reset the user password and regain access to your Windows account with a few mouse clicks.
You can download PassFab 4WinKey on a working Windows compute. Once downloaded, you can install the tool and create a password reset disk for your culprit Windows PC.
FAQs About Powershell Password Reset
Can I use PowerShell commands if I forgot my Windows password?
No, you can’t. However, there are two workarounds:
- (Recommended) Boot Windows from an installation media, get to the external command prompt window and reset the password.
- You can try a third-party tool called PassFab 4WinKey to create a password reset disk and use it to reset your Windows local account password.
Why should I use PowerShell to change or reset a local Windows account password?
While it may sound unnecessary as you won’t reset a password if you already know it, and you don’t need to take this route to change the password either when several GUI-based options are present, consider a scenario where you, as a systems administrator, wants to do this on more than 100 PCs within 60 minutes. In such a case, you can prepare a PowerShell script and run it on all the computers, and your task will be completed in 5 to 10 minutes.
Why do I need a different computer while using PassFab 4WinKey to create a password reset disk?
You need to create a password reset disk when you forget your Windows password and can’t log in to your computer. Because you cannot sign in, you won’t be able to use the web browser to download any app, let alone install it on the PC.
Therefore, you need a different, working computer that you can use to download and install PassFab 4WinKey and use the program to create a password reset disk.
You can then connect this disk to the troubled PC to reset the password. Once you’re done, you no longer need to use the PowerShell password reset process.
Although you can easily change a password in PowerShell using the correct commands, the process works only when you already know the password and can sign in to your account. You can launch PowerShell as an administrator only after logging in to Windows. Nevertheless, you can always create and run a script on PowerShell for password reset to automate and expedite your tasks.