Friday, January 11, 2013

Remote Desktop - Autohotkey script

As a system administrator I need to access many computers remotely. RDP is a favorite tool for this as it provides all the needed Windows functionality to perform any task. Other tools such as VNC or Teamviewer have technological limitations or corporate restrictions. I created an Autohotkey script for accessing many 'favorite' servers without too much typing.





 I also forced the window size for the RDP. I do not like full screen RDP simply because none of my AHK scripts on my workstation work on an RDP session when it's in full screen mode (ProTip). There are two sizes in mode script because my screen resolution on the monitors at my home are less than the awesome screens at my work desk and when I RDP to my workstation that causes problems. So there are two, you can modify the script if that's not a problem.
Another nice thing is that I can select a 'favorite' computer or type one out. I added this as a hotkey to my quicktype script (from an earlier post). You can comment out the Icon line if you don't want have a cool icon. Just cut/paste the text between the lines and add as an AHK file.

-----------------------------------

Gui, add, Text, w250, Select Server
Gui, Add, ComboBox, vOpenServer, ComputerA|ComputerB|ComputerC|ComputerD|ComputerE|ComputerF
Gui, Add, Button,x10 y52, LARGE
Gui, Add, Button,x70 y52 , small
Gui, Add, Button,x120 y52 , Cancel
Gui, add, Text,x10, Large = 1300x950 | Small = 800 x 600
Gui, add, Picture, Icon2, C:\Users\username\AHK\RDPIcon.ico
Gui, Show,, Remote Desktop
return
ButtonLarge:
Gui, Submit
Run, c:\windows\system32\mstsc.exe /v:%OpenServer% /w:1300 /h:950
ExitApp
ButtonSmall:
Gui, Submit
Run, c:\windows\system32\mstsc.exe /v:%OpenServer% /w:800 /h:600
ExitApp
ButtonCancel:
ExitApp
-----------------------------------

2 comments:

Anonymous said...

Why does the script close itself after I make a selection?
I constantly need to reopen the script to launch this app.

Unknown said...

I have it set to exit the script with the 'ExitApp' line.

If you wish you could create a hotkey for this script so you can open it faster.