How to enable command line remote access to a Windows Server 2008 machine

remote-accesswindows-server-2008

I have a Windows Server 2008 machine. 99% of the time, all I need to do to administer it is run command line commands such as hg fetch. I would like to move from Remote Desktop to just opening a (secure) command-line session.

Some googling found this article which only lists third-party ssh servers for Windows. I want the most "legit" option. What do you recommend?

Best Answer

Install Powershell 2.0

In powershell on the server enter:

set-executionpolicy remotesigned -force

enable-psremoting -force

Then from a remote machine (that has powershell enabled) initiate a remote connection:

etsn -cred username -comp targetname

If you are on the same domain and have proper authorization you can skip the '-cred username' part, but I've found if you're crossing domains with non-mutual trust then it is necessary to use credentials of the remote domain.

Also if you want to just issue one command you can do something like...

icm targetname {$host }

The above should be enough to get you started down the magical world of powershell remoting.