Remote Command Line On Windows
For a while now I’ve been curious if there was a way on Windows to get a remote command line from another computer. You know, just a plain old command prompt, that when you entered commands they ran on a remote computer instead of your own. This is a staple on Linux systems, since they are all based on the command line, but with GUI-based Windows it was proving trickier to do.
I had found some halfway solutions that never seemed to work right, and I wasn’t too happy with any of them. But today I think I finally found the answer I was looking for. It does depend on a free little software download, but aside from that there’s no installation or setup required on either computer.
I first read about it on this site. What you do is go to a certain MS TechNet page and download the PSTools package (linked in the right sidebar). This software is from Sysinternals, a development group that was acquired by Microsoft a couple of years ago. So it’s “official” MS software, much like the PowerToys.
Anyway, here are the instructions for use:
- Download PsTools.zip from this site.
- Extract to a folder on your hard drive. If you can put them in the path, like in C:\Windows\System32, even better.
- Open a Command Prompt: Start > Run > cmd.exe
- Change to the directory you extracted the files to:
cd c:\pstools
, for example. - Enter the command
psexec \\RemoteComputer cmd.exe
. Replace RemoteComputer with the name of the computer you want to take control of. You have to have admin rights on the remote computer. - A Sysinternals EULA might pop up. Accept it.
- Watch as a new command prompt appears in your console window. You’re now controlling the remote computer!
I really think this is something that should be folded into Windows itself. And maybe it will be, since Sysinternals is under Microsoft control now. I know that when I’m working from home, or working on my Tahoe office computers from Carson City, sometimes I just want a command line on the remote computer, especially if I’m doing a little housekeeping behind the scenes while a user is on the computer. Now I can do it with no problem, now that I’ve found this neat little tool.
And PsExec is just one of 12 tools in the PsTools package. The rest of them are probably just as useful.
Filed under The Computer Vet Weblog
I am really thrilled to see this article. You have given some instructions for Windows and what about remote command line for linux os called as Mint?Nice post and try posting more articles like these in future.
“A Sysinternals EULA might pop up. Accept it.”
If you run psexec with the /accepteula parameter you will not have the popup. Especially valuable when used with other tools from the package.
And, yes, the rest of them is pretty useful too.
[…] Reference Official Website […]
This is fantastic. I’m really glad I stumbled upon this article, as it’s saved me a lot of hassle and irritated users. 🙂
With Linux this soo common. I found tour article trying to do the same thing. Surprised how hard it is.
Unfortunatelly it doesn’t work as one might expect. It’s ok with simple tasks like running commands, that return a stdout or stderr messages. If you run something that runs interactively in a command line and takes over it until you exit, like osql.exe from SQL Server, it’s useless for you – all you see is a blinking cursor that doesn’t react for anything but ctrl+c.
Good article! There are several apps out there that will get the job done, some free and others not. One such free tool is NetCat (originally developed for the unix environment but later ported to windows as well). The tool is free, but it seems that less and less ppl r using it so it has become harder to find and download. Netcat is the network admin’s swiss army knife. RTM (Remote Task Manager) is a commercial product (free to try for 30 days), and once installed and working will allow you access to the remote windows machine’s task manager.
As far as simplicity goes and speaking of command line only, NetCat will get the job done!
Works up to the point where I get the message “Access is denied …” to the remote computer. Now what??
@brian
same here, useless
useless piece hasn’t really down much coz I can run commands but I need the GUI interface relayed on my screen
Kevin,
GUI access isn’t the point of this article. Some of us specifically required command line access. If you want GUI access then use VNC. Why Microsoft didn’t build in a proper command line originally I’ll never know. What do Windows server admins do?
excellent article. Thanks!
[…] Link: Remote Command Line On Windows | The Computer Vet Weblog […]
Worked great – I needed to flushdns on a remote system without disturbing the end user. Thanks!
Hello, we are developing a similar cross platform tool (e.g: control Linux-shell from Windows), and would like to hear from the users of this tool about the desired futures in addition to the existing once. Please answer in a comment here.
If I extract the pstools files to c:\windows\system32, should I replace the existing pdh.dll with the form the pstools zip?
Can some one help me please… I need a script/command to run from my computer to refresh desktop on remote computers. I have full access of remote computers using VNC but i need a command to refresh desktop on more then one computer with out using VNC.
Thanks
i’ve got this message :
make sure that default admin$ share is enable
what does it means??
need ur help soon..
Can any one tell me how to open a non-executable files through this process. Coz. I can’t open any text files
Seriously, netcat to remotely access a windows server? It’s unencrypted and unauthenticated. Netcat is a wonderously powerful tool but better be sure you understand what it is and is not good at – remember you can do just about anything with a swiss army, you can even cut bread with it but you’ll always be better off with a proper bread knife.
Personally a find a decent win32 ssh server does the job with a fully interactive CLI.