Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to remote into ~50 machines and run a batch file. Is there any way I can start up an RDP session and call cmd?

share|improve this question

migrated from stackoverflow.com Oct 22 '12 at 7:15

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 3 down vote accepted

If you need to use RDP to access these machines, there are shells for mstsc.exe that allow command line auto-login and running a program upon connection. One that comes to mind is Remote Desktop Plus. You could use a batch script to log in to the given machines with the following syntax:

rdp /v:computer /u:username /p:password /start:"pathtoscript/script.bat"

Download from http://www.donkz.nl/

share|improve this answer
    
Actually you don't need a third party tool (moved answer below for better formatting) –  cirrus Oct 17 '12 at 14:25

Windows Remote Shell is what you want;

http://technet.microsoft.com/en-us/library/dd163506.aspx

Once setup, you can go WinRS -r:MYSERVER "cmd.exe" which will run cmd.exe on the remote machine and bring you a remoted console session locally. Alternatively, you could just run any other command directly on the box instead.

Actually, if you are need to use RDP (and I wouldn't bother just to run a batch file if I could avoid it) you could run a shell (or any other command) without a 3rd party program. Just run mstsc.exe, choose an alternate shell and save the RDP file.

The key settings you need are looking for are;

full address:s:yourserver.domain.com:3389
alternate shell:s:c:\windows\system32\cmd.exe
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.