1.

Solve : Creating a batch file to run RDP and connect?

Answer»

Hi, I am a complete novice with zero experience.

I have daily tasks at work which require me to RDP to servers to check logs etc and was hoping I could create a batch file to launch on startup to save myself a bit of time.

Any help would be greatly appreciated.

So far all I have DONE is copy scripts I have found online but I'm struggling to find something suitable for my needs in this instance.  I have read some of the threads in this forum on similar requests but am baffled :/


Thanks

AdrianSo far I have got this far..

start /d "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories" mstsc.exe

I'm such a n00b its almost embarrassing  I don't RDP anywhere - what did you want to automate?

What procedure do you use to RDP?Hi, did I not reply to your question above?

Ideally I want to automate logon to an exchange server and run services.msc or test-servicehealth.  This check is one of my daily checks.http://windows.microsoft.com/en-AU/windows-vista/Use-command-line-parameters-with-Remote-Desktop-Connection

You can automate the connection here.

You might like to use PSEXEC to connect remotely and execute programs and get info, but not if you need GUI access.Not really sure what I need to add to make this work, there are no examples :/ I get further with what I've written already.  I need to automate the launch - connection - fill password field - connect.

I dont know if this is even possible.

Thanks for the link though. After further investigation I think a batch file maybe inappropriate for my needs, thoughts?The link shows that you need a connection file, and that will allow you to connect to the remote server with few keystrokes.

You create/edit the connection file and write the batch file, call it R.BAT and put it in c:\Windows
Then press Windows + R, type R and press enter.  You should be connected.

The way I read it the link shows that with a connection file all you need is this:

Code: [Select]echo off
mstsc "%userprofile%\desktop\server1.rdp"


where you create the server1.rdp on your desktop.  You may be able to just double click the RDP file if the associations work.
Well ive stumbled accross this online,

mstsc /v: "IPADDRESSHERE" /w:640 /h:480

Which gets me as far as putting my password in, any ideas for another line to add password and HIT ok a few times?Right I just need a command to fill the password field then im there.  Anyone help out?Even if you do get your SCRIPT working, you will save yourself a huge amount of effort using this if you keep having to log into different (windows) servers - the Remote Desktop Connection Manager
http://www.microsoft.com/en-us/download/details.aspx?id=21101PowerShell can create that script. Will create a temp connection to the target machine.
set-location \\targetmachine\c$Did you try dropping down to "cmd" and typing "mstsc /?"  This will give you all of the commands that remote desktop will use/require.
I use batch files in the same way you do with a choice command to go through the remote serversSOLUTION:
Best way to go about this is open mstsc enter all your connection details then click save as, save to the desktop and your done. 

However if you wish to run mstsc as an ADMINISTRATOR or for any other elevated commands create a notepad and enter:   mstsc /v:rdp.mycompany.com /console /admin
save as RDP.batThey left 1 1/2 Years AGO...



Discussion

No Comment Found