How to Use PowerShell Change Administrator Password in Windows OS

How to perform PowerShell change administrator password on your Windows computer? In this post, you’ll learn to use PowerShell change password and an easier way to do this task.

Posted by @Lucas July 24, 2024 Updated By @Lucas June 13, 2023

What is PowerShell?

Like CMD, PowerShell is also a command-line program designed for system administration and automation. However, you can consider it an improved version of CMD, because it scripts advanced language that system administrators can use to automate activities related to controlling operating systems and processes. Thus, it can provide a comprehensive set of commands and tools to manage and control Windows environments efficiently.

Importance of regularly changing administrator password

Securing your computer systems and data is critical in today's digital world. Changing the administrator password regularly is an important part of computer security. This helps to prevent illegal access and safeguards critical data. By updating the password, you guarantee that only authorized users may do system administration operations. It also lowers the likelihood of password-related security breaches, such as brute-force assaults or password leaks.

As PowerShell allows administrators to perform various tasks, including password management, with ease and flexibility, in this article, we will explore how to change the administrator password using PowerShell, a powerful scripting language and automation framework developed by Microsoft.

Detailed steps for PowerShell change administrator password

Now, in this section, you’ll see all details on how to change passwords in PowerShell. Some commands might be a little complex, please check them carefully after you type each one.

Step 1. Press the Windows key, type "PowerShell" in the search bar, and right-click on "Windows PowerShell" in the search results to select "Run as administrator."

Step 2. Check the current password policy by executing the following command in PowerShell: Get-ADDefaultDomainPasswordPolicy

Note: Before proceeding with changing the administrator password, it's essential to understand the current password policy. The password policy defines the rules and requirements for creating and changing passwords on a system.

This command will display the current password policy settings, such as password complexity requirements, password expiration, and minimum password length.

Step 3. Now, we can use PowerShell to change administrator password. In the elevated PowerShell window, execute the following command:

• $NewPassword = ConvertTo-SecureString "******" –AsPlainText –Force • Set-ADAccountPassword Bob –NewPassword $NewPassword -Reset

In the example, "Bob" is the username of the local user account. You should replace "******" with the password you want to set.

If you want to use PowerShell to change local user password, just like the admin account, you need to change the user name into the target name. Here, the example is “Jack”.

After you change password in PowerShell, you can verify that the change was successful. Execute the following command in the PowerShell window: Get-ADUser -Identity Administrator | Select-Object PasswordLastSet

The output will display the date and time when the password was last set for the Administrator account. Make sure it corresponds to the time you changed the password.

Now, you can restart your computer and log in using the Administrator account and the new password. If you can log in successfully, it means the password change was successful.

An easier tool for changing admin/local user password for Windows OS

It’s unavoidable to type many long command lines if you choose to change administrator password in PowerShell. For common users, it’s a small challenge. In fact, if you’re not familiar with the command tools, we suggest you don’t use them in case the wrong command lines cause irreversible situations.

Here, for changing administrator and local user passwords, we recommend you to AOMEI Partition Assistant Professional. This practical program can assist you in resetting a computer password. Its "Reset Password" feature allows you to not only reset the Administrator password but also modify the local password.

After building a bootable USB with a bright and clear operating interface, you can use it to complete the job of resetting Administrator password. Only click the mouse, and you can start to reset password.

More functions also allow you to use it to improve PC performance, such as Disk Clone Wizard, Migrate OS to SSD, Allocate Free Space, Move installed programs to another drive, etc.

Free DownloadWin 11/10/8.1/8/7/XP
Secure Download

Step 1. Connect a USB with another PC in normal use, then download and open this reliable tool, click “Tools” at the top toolbar, and select the “Reset Windows Password” option.

Step 2. You need to create a bootable USB, click “Next” to continue.

Step 3. Select the target USB boot device and click “Proceed”.

Step 4. Please read the words about creating bootable USB (All data on the USB will be deleted), click “Yes”.

Step 5. Wait for a while, it will create the password reset USB, then click “Finish”.

Step 6. Take out the USB and then insert it into your computer, then restart it. You’ll change the boot drive, boot the PC from the created USB and choose the OS and click “Next”.

Step 7. Choose one account and tick “Reset Account Password”, then click “Next”.

Step 8. In the new window, you can set the new password and click “Yes”. 

Tip: The Professional Edition supports Windows 11/10/8/8.1/7/XP/Vista. If you want to use it for the Windows Server system, you can choose the Server Edition or other advanced editions.

Ending

PowerShell makes it simple and easy to change the administrator password and manage password policies. You may improve the security of your Windows environment and protect sensitive data by following the methods indicated in this article.

If you don't want to utilize difficult command lines, you may use AOMEI Partition Assistant to change or reset your password even without logging onto your machine.