Level 1
0 / 100 XP

Change a Password on a Remote Computer Answer

Changing the password on a Remote Computer

  • From the Host, let’s say you wanted to change the password on a remote computer for a local user named rmatthews.

  • **First, we would create a remote session:
    From the Host computer **Open PowerShell ISE in Admin mode.
    I’ll go ahead and copy and paste this command

Enter-PsSession -Computername VSC1 -Credential Administrator

Now I’ll go ahead and copy and paste the command to change the password.

$NewPassword = "TEG1!99gh" | ConvertTo-SecureString -AsPlainText -Force

Set-LocalUser -Name "rmatthews" -Password $NewPassword

Here is the Explanation:

  1. $NewPassword = "TEG1!99gh"

This is the new password you want to set for the user "rmatthews." You can replace it with the desired password.

| (pipe symbol): This is used to pass the plain text password to the ConvertTo-SecureString cmdlet as input.

ConvertTo-SecureString This cmdlet is used to convert the plain text password provided on the left side of the pipe into a secure string. Here's what each part does:

-AsPlain Text: This parameter tells PowerShell that the input password is in plain text format.

-Force: This parameter is used to suppress any confirmation prompts that may appear when converting the password to a secure string.

2\. Set-LocalUser: This is a PowerShell cmdlet used to modify properties of a local user account. In this case, it's being used to change the password.

-Name "rmatthews": This parameter specifies the name of the user account you want to modify, which is "rmatthews" in this case.

-Password $NewPassword: This parameter sets the password for the user account. The $NewPassword variable contains the secure string obtained from step 1, which will be set as the new password for the "rmatthews" user.

So, when you run this script, it takes the plain text password "TEG1!99gh," converts it into a secure string, and then…