Sunday, January 15, 2012

Quickly Launch Remote Desktop Connections on Mac OS X

At work and at home I have a few PC servers that I frequently need to remote connect to. My Mac launcher application of choice is Alfred. I wanted to be able to use it to instantly launch connections to those servers without needing to type in anything but the first few letters of the server name. Getting this setup on Mac OS X is a bit of a hassle, but here is basically what I do:
  • I use the Remote Desktop Connection Client for Mac to connect to the PC servers.
  • After installing the client and typing in the name of the server I want to connect to I go to preferences and customize the connection:
    • Under the Login tab I enter account information
    • Under the Display tab I specify my preferred remote desktop size
    • Sometimes I tweak some of the other settings, but those two are of main importance
  • Then I go to File and Save As... and save this connection as a .rdp file on my Mac
  • Now I can double-click on the file to be instantly connected to the remote server
  • Problem is that application launchers don't really know how to run .rdp files, so I want to take it a step further and create a runnable Mac Application for each .rdp file.  To do this I use an open source program called Platypus, that a coworker of mine told me about.  
  • Unfortunately Platypus does not know how to run .rdp files, but it does know how create Applications that launch shell scripts.  Hence, I create a simple shell script to launch my remote desktop connection.  E.g. if I want to launch SteiniServer.rdp, then my script would look like this:

    open "/Applications/Remote Desktop Connection.app" ~/Documents/RDC/SteiniServer.rdp

  • Then I save the script on my computer in a file called rdcSteiniServer.sh
  • Now I open Platypus and use it to create a Mac Application with the following settings:
(If you want to add a custom icon for your application you can right-click the image and choose Select Image File...)
        
The only thing that really matters is selecting Script Type Shell and the path to your script.
  • Then I hit Create and select:


  • Now I am ready to launch my remote connection with Alfred, which I do like this:
  • Basically, I activate Alfred (Ctrl-A for me) and as soon as I have typed in RDC it finds the RDC Steini Server Application and when I hit enter I am automatically logged into the remote PC server without having to type in anything else.

    If you have a simpler way of achieving the same I am eager to hear :-)

    5 comments:

    Charles McPhate said...

    Just came across this at random. You don't need a separate shell script or Platypus to accomplish this. You can open Automator and create a new application. Choose Run Shell Script from the actions list, then enter your shell command. Save it to your Applications folder, and it should show up just fine in Alfred. This is how I launch multiple Firefox profiles using Alfred.

    Steinn Jónsson said...

    Thanks for the tip. That sounds simpler.

    Anonymous said...

    Great Tip!

    Do You know how to embedd the password for the rdp connection ?

    Greetings, Andy.

    Steinn Jónsson said...

    Andy, you should be able to save the username under the RDC Login tab. E.g. select "File" and "Edit a Connection..." and open your .rdp file. It should default to the Login tab, where you can type in a username and password. If you check "Add user information to your keychain" you shouldn't have to type it in again next time you use the connection.

    Unknown said...

    Awesome. Thank you. https://itunes.apple.com/us/app/microsoft-remote-desktop-8-0/id715768417?mt=12 is the download link for the remote desktop Mac client