To change a local user's password on Windows Server 2022 using PowerShell, you can use the Set-LocalUser
cmdlet. This is a straightforward process, and I'll guide you through the steps to do this. Make sure you have the necessary administrative privileges to perform these actions.
Here’s how to change a password for a local user:
-
Open PowerShell as Administrator:
- Right-click the Start button, and select “Windows Terminal (Admin)” or “PowerShell (Admin)” to open PowerShell with administrative privileges.
-
Use the
Set-LocalUser
cmdlet to change the password:Set-LocalUser -Name "username" -Password (ConvertTo-SecureString -AsPlainText "NewPassword" -Force)
Replace
"username"
with the actual username of the account whose password you want to change, and"NewPassword"
with the new password.
This command will update the password for the specified user. The ConvertTo-SecureString
cmdlet is used to ensure the password is handled securely.