Using PowerShell to change local user password remotely

Step 1: Verify the target computer connection

Ensure the target computer is reachable. The script below confirms if RemotePC is online.

Test-Connection -ComputerName "RemotePC" -Count 2

Step 2: Change the local user password

Set a new password for a local user. This changes the password for LocalUser on the local machine.

$Password = ConvertTo-SecureString "NewPassword123!" -AsPlainText -Force Set-LocalUser -Name "LocalUser" -Password $Password

Step 3: Change the password on a remote machine

Use PowerShell remoting to change the password remotely. This updates LocalUser’s password on RemotePC.

Invoke-Command -ComputerName "RemotePC" -ScriptBlock {
$Password = ConvertTo-SecureString "NewPassword123!" -AsPlainText -Force
Set-LocalUser -Name "LocalUser" -Password $Password
}

Step 4: Apply to multiple computers

Update passwords on multiple computers. The script below updates LocalUser's password on all specified computers.

$computers = @("PC1", "PC2", "PC3")
foreach ($computer in $computers) {
Invoke-Command -ComputerName $computer -ScriptBlock {
$Password = ConvertTo-SecureString "NewPassword123!" -AsPlainText -Force
Set-LocalUser -Name "LocalUser" -Password $Password
}
}

FAQs

1. How do I reset a local user password remotely?

Run the script below to reset a local user password remotely. Replace RemotePC with the actual remote system.

Invoke-Command -ComputerName RemotePC -ScriptBlock { net user Administrator "NewPass@123" }

2. Can I change passwords on multiple remote machines?

Yes, you can change passwords on multiple remote machines by running the script below.

$computers = @("PC1", "PC2", "PC3")
Invoke-Command -ComputerName $computers -ScriptBlock { net user Administrator "NewPass@123" }

3. Do I need admin rights to reset a local user password remotely?

Yes, you must run PowerShell as an administrator.

 
  • Step 1: Verify the target computer connection
  • Step 2: Change the local user password
  • Step 3: Change the password on a remote machine
  • Step 4: Apply to multiple computers
  • FAQs

ADSelfService Plus trusted by

A single pane of glass for complete self service password management
Email Download Link