Change a Password on a Remote Computer Answer
Full-Access Members Only
Sorry, this lesson is only available to Server Academy Full-Access members. Become a Full-Access member now and get instant access to this and many more premium courses. Click the button below and get instant access now.
Instructions
Q&A (0)
Notes (0)
Resources (0)
Saving Progress...
Resources
There are no resources for this lesson.
Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.
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:
- $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:
-AsPlainText: 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 sets that secure string as the new password for the "rmatthews" user.
Please note that using this approach, the password is still stored in memory as a secure string during the script's execution, which is more secure than storing it as plain text.
- Verify the Password Change
You can verify that the password has been changed by attempting to log in with the new credentials on the remote computer.
In summary, the script is designed to securely set or change the password of a local user account on a Windows system.
Server Academy Members Only
Sorry, this lesson is only available to Server Academy Full Access members. Become a Full-Access Member now and you’ll get instant access to all of our courses.