Monday, March 1, 2010

How to Change Windows Local Administrator’s Password Remotely via CLI

In order to change a local user’s password in the computer being used, we can run this command:

           net user username newpassword

But to change a local user’s password in another computer, first of all you need to have a administrator privileges and then need to make connection to the IPC$ of the computer.

Use this command to establish a IPC connection:

           net use \\computer_name\ipc$ /user:administrator

Press Enter and then enter the administrator’s password when prompted.

For Example : To change the administrator’s password of the computer called vmcitrix04:

            net use \\vmcitrix04\ipc$ /user:administrator


Local name
Remote name \\vmcitrix04\ipc$
Resource type IPC
Status Disconnected
# Opens 0
# Connections 1

The command completed successfully.

But if we want to automate the service to change the local administrator’s password or to schedule the task for later, then we need to find out the time on the computer. So, we need the current time on the computer by using this command :

      net time \\vmcitrix04

Current time at \\vmcitrix04 is 3/1/2010 4:19 PM
The command completed successfully.

Finally, use the below cmd format to schedule the task at 4:22 using this command:

    at \\vmcitrix04 4:22 cmd /c net user administrator testing

Added a new job with job ID = 1

The job is scheduled to run on vmcitrix04 at 4:22 by changing the local administrator password to testing.

No comments:

Post a Comment