Enabling Remote Administration using Command Line

Paulo Bazzo

Why are we doing this?

Have you ever went to sleep and realised you forgot to turn off your computer? Well, this is the most mundane reason why you would want to enable your computer to be accessible remotely from within your network We are simply enabling the ease management of another computer inside our network via Powershell or Cdm To control our computer outside our network would require some configurations on the router called Port Forwarding, which we will look into another time.

Advantages and Pitfalls

Advantages

Enabling access to our 'other' computer over command line will enable us to easily manage it

  • Manage services
  • Install pataches and updates
  • File transfers

Pitfalls

One of the pitfalls is that you could potentially be making your computer more vulnerable if you do not set up correctly. This is because if someone infects your main computer, they can easily pivot into your remote machine, so make sure you keep high alert on your defenses.

We can easily trigger a Windows Update remotely by running wuauclt /detectnow

Installing PSExec

We will need to download a Microsfot official tool from SysInternals - PsExec

After downloading, we are going to extract the files inside the PATH environment so we can easily run from cmd on my case I am extracting the files on C:\Apps and will be adding a new System Variable for this path.

We can connect using the computer name

  psexec \\PC_NAME cmd   

Or we can connect using the computer IP

  psexec \\PC_IP powershell    

There are many other things we can do with psExec, for a full list of commands please refer to the official docs.

Resources

StackOverFlow Microsoft Docs