How to: Change Active Directory user passwords remotely

The following is a comparison between the steps involved in changing local user passwords remotely with Windows PowerShell and ADSelfService Plus, a comprehensive password management tool:

With PowerShell
  • Change the Active Directory password for a user account

    Executing this code will reset the password for a single user in Azure Active Directory.

    $Password = Read-Host -AsSecureString $UserAccount = Get-LocalUser -Name "User02" $UserAccount | Set-LocalUser -Password $Password
  • Allow users to change their passwords themselves, based on OU and group membership

    No supported.

With ADSelfService Plus
  • Self-service change password
    • Go to ADSelfService Plus admin portal.
    • Navigate to Configuration > Self-Service > Policy Configuration.
    • Select Change Password.
    • Click Select OUs/Groups to granularly select which set of users need to be empowered with change password option.
    • Click Save.

Once the password change option is configured in ADSelfService Plus, all users can securely change their Active Directory password from the end-user portal.

With ADSelfService Plus, even the VPN and OWA users can change their passwords remotely through a secure web-portal. That means, ADSelfService Plus also updates the cached credentials stored on the user’s machine.

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.

Simplify Active Directory password self-service with ADSelfService Plus.

ADSelfService Plus trusted by

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