Re-ordering Remote Desktop Connections
I have the adminpak.msi installed so that I can use the Remote Desktop MMC to connect to all of my servers. As I add a server, it goes to the bottom of the list of available servers. I can't find out how to re-order them into more logical groupings, or at least alphabetical. Any ideas?
Solution 1:
Royal TS can help you manage/organize your Remote Desktop connections. Also Terminals may do something similar. An alternative would be to create Remote Desktop shortcuts for each connection and store them in a folder where they can be sorted by name.
Solution 2:
I would highly recommend a free application that I've been using for the last few weeks (and I am in no other way affiliated with), called RD Tabs (by Avian Waves). The tool is very flexible, allowing you to create multiple panes, each containing multiple tabs, with quick thumbnail preview access, keyboard shortcuts to just about every feature (great for people that don't like to be forced to use a mouse), and even command line / script automation of the tool. Sorting and grouping involves nothing more than drag and drop, and you can import your existing Remote Desktop configuration file(s) with ease.
Solution 3:
I found a solution. Looks like the msc file has an encrypted area that is just not accessible. So I found a script from Brett Clarke at http://twistingthewick.org. I've modified it a bit to add structure and login information. It uses our old friend SendKeys.
You need to create a CSV with:
server-name-or-ip,description,userid,domain
one per line for each server. You'll have to sort this the way you want it.
You can also add a line to break things up into separate ad-ins using the syntax:
---,some-name,,
some-name is not used; each section is named Remote Desktops. If someone can figure out how to change the name, please let me know.
For now, this seems to work, and allows re-building any time you need to add a server. You might need to tweak the delays on your system.
Oh, and this probably won't work on Vista or Windows 7 as the SendKeys method has been disabled for security purposes.
I like to share drives, so this script checks that box. You can modify it to do pretty much anything you need.
First, though, you need to start out with a blank tsmmc.msc file. Open MMC and add a Remote Desktops snap-in. The script wants it called blanktsmmc.msc in c:\Projects\SortMmc. Of course, you'll need to have the Windows Admin Pak loaded.
Script is utilitarian, designed for speed of coding, not elegance. If you make improvements, please share.
And I'm new here. If you like this, I could use some Karma!
' CreateTSMMC.vbs
' Script to re-create tsmmc entries in order
' Author: Brett Clarke http://twistingthewick.org
' Version: 0.1 – 21/06/2007
'
' Updated by Brian Travis, adding login and drive info
' Version: 0.2 - 2009-08-26
'———————————————————————
'Declare some variables
Option Explicit
Const ForReading = 1
Dim objShell, objFSO, objFileCopy, objDictionary, objTextFile
Dim strBlankMMC, strWorkingMMC, strTemplate, strNextLine
Dim arrRDPList
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")
strBlankMMC = "c:\Projects\SortTsmmc\blanktsmmc.msc"
strWorkingMMC = "c:\windows\system32\tsmmc.msc"
strTemplate = "c:\Projects\SortTsmmc\tsmmc.csv"
Set objFileCopy = objFSO.GetFile(strBlankMMC)
Set objTextFile = objFSO.OpenTextFile (strTemplate, ForReading)
' copy the blank template file over the working file
objFileCopy.Copy (strWorkingMMC)
' start up MMC
objShell.Run "c:\windows\system32\tsmmc.msc"
' wait for the app to start
Wscript.Sleep 1500
' get to the plugin
objShell.SendKeys "{DOWN}"
' read the CSV file, and parse the entries into the MMC session
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.ReadLine
arrRDPList = Split(strNextLine , ",")
if arrRDPList(0) = "---" then
' create a new group
objShell.SendKeys "%f"
objShell.SendKeys "m"
objShell.SendKeys "%d"
objShell.SendKeys "rem"
objShell.SendKeys "%a"
objShell.SendKeys "%c"
objShell.SendKeys "{ENTER}"
objShell.SendKeys "{END}"
else
objShell.SendKeys "+{F10}"
objShell.SendKeys "A"
objShell.SendKeys arrRDPList(0)
objShell.SendKeys "{TAB}"
Wscript.Sleep 100
objShell.SendKeys "{TAB}"
Wscript.Sleep 100
objShell.SendKeys arrRDPList(1)
Wscript.Sleep 100
objShell.SendKeys "{TAB}"
Wscript.Sleep 100
objShell.SendKeys "{TAB}"
objShell.SendKeys arrRDPList(2)
Wscript.Sleep 100
objShell.SendKeys "{TAB}"
objShell.SendKeys "{TAB}"
objShell.SendKeys arrRDPList(3)
objShell.SendKeys "{TAB}"
objShell.SendKeys " "
objShell.SendKeys "{ENTER}"
Wscript.Sleep 100
' turn on drive sharing
Wscript.Sleep 100
objShell.SendKeys "{TAB}"
objShell.SendKeys "{END}"
objShell.SendKeys "+{F10}"
objShell.SendKeys "r"
objShell.SendKeys "+{TAB}"
objShell.SendKeys "{RIGHT}"
objShell.SendKeys "{RIGHT}"
objShell.SendKeys "{TAB}"
objShell.SendKeys "{TAB}"
objShell.SendKeys " "
objShell.SendKeys "{ENTER}"
' get back to left column
objShell.SendKeys "+{TAB}"
end if
Loop
objShell.SendKeys "^s"
WScript.Quit
Solution 4:
Not sure if the buttons/fields/options (or whatnot) changed in my version of Remote Desktops (v5.2.3790.0), but if anyone is having trouble getting v0.1 or v0.2 to build the RDs, here's a v0.3 with my very minor changes that finally got it automating correctly on my XP machine. Hope this helps.
PREREQS (See v0.1, v0.2 posts for details on how to make these files):
Blank tsmmc.msc file in current directory called blanktsmmc.msc.
tsmmc.csv file in current directory in appropriate format.
Example CSV file broken up into sections:
---[AGENTS]---,,,
agent-pc,,neo,thematrix
agentsmith-pc,,neo,thematrix
---,,,
---[THEMATRIX]---,,,
merovingian-pc,,neo,thematrix
theoracle-pc,,neo,thematrix
thesource-pc,,neo,thematrix
---,,,
---[ZION]---,,,
cypher-lt,,neo,thematrix
morpheus-pc,,neo,thematrix
tank-lt,,neo,thematrix
trinity-pc,,neo,thematrix
Revised v0.3 code:
' CreateTSMMC.vbs
' Script to re-create tsmmc entries in order
' Author: Brett Clarke http://twistingthewick.org
' Version: 0.1 – 21/06/2007
'
' Updated by Brian Travis, adding login and drive info
' Version: 0.2 - 2009-08-26
'
' Updated by Jack Hamilton, to make it work in Remote Desktops v5.2.3790.0
' Version: 0.3 - 2012-08-15
'
' NOTES:
' (1) If you get subscript out of range error, check your CSV for any blank lines
' or lines with too many commas and fix/delete them.
'
' (2) Be sure to close all programs before running, especially those like email
' or instant messaging that can pop up a notification window causing the
' window focus to change and thereby interrupt the automation process.
'———————————————————————
'Declare some variables
Option Explicit
Const ForReading = 1
Const Sleep_Long_Pause = 1500
Const Sleep_Between_Keys = 200
Dim objShell, objFSO, objFileCopy, objDictionary, objTextFile
Dim strBlankMMC, strWorkingMMC, strTemplate, strNextLine
Dim arrRDPList
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")
strBlankMMC = ".\blanktsmmc.msc"
strWorkingMMC = "c:\windows\system32\tsmmc.msc"
strTemplate = ".\tsmmc.csv"
Set objFileCopy = objFSO.GetFile(strBlankMMC)
Set objTextFile = objFSO.OpenTextFile (strTemplate, ForReading)
' copy the blank template file over the working file
objFileCopy.Copy (strWorkingMMC)
' start up MMC
objShell.Run "c:\windows\system32\tsmmc.msc"
' wait for the app to start
Wscript.Sleep Sleep_Long_Pause
' get to the plugin
objShell.SendKeys "{DOWN}"
' read the CSV file, and parse the entries into the MMC session
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.ReadLine
arrRDPList = Split(strNextLine , ",")
if arrRDPList(0) = "---" Then
Wscript.Sleep Sleep_Between_Keys
' create a new group
objShell.SendKeys "%f"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "m"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "%d"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "rem"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "%a"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "%c"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{ENTER}"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{END}"
Wscript.Sleep Sleep_Between_Keys
Else
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "+{F10}"
Wscript.Sleep Sleep_Between_Keys
' Add Connection
objShell.SendKeys "A"
Wscript.Sleep Sleep_Between_Keys
' IP/Hostname
objShell.SendKeys arrRDPList(0)
objShell.SendKeys "{TAB}"
Wscript.Sleep Sleep_Between_Keys
' skip Browse button
objShell.SendKeys "{TAB}"
Wscript.Sleep Sleep_Between_Keys
' Description
If arrRDPList(1) = "" Then
objShell.SendKeys arrRDPList(0)
Else
objShell.SendKeys arrRDPList(1)
End If
Wscript.Sleep Sleep_Between_Keys
' Skip "Connect to Console"
objShell.SendKeys "{TAB}"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{TAB}"
Wscript.Sleep Sleep_Between_Keys
' Username
objShell.SendKeys arrRDPList(2)
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{TAB}"
Wscript.Sleep Sleep_Between_Keys
' Skip Password
objShell.SendKeys "{TAB}"
Wscript.Sleep Sleep_Between_Keys
' Domain
objShell.SendKeys arrRDPList(3)
' Skip "Save Password"
objShell.SendKeys "{TAB}"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{TAB}"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{ENTER}"
Wscript.Sleep Sleep_Between_Keys
end if
Loop
' get back to left column
objShell.SendKeys "+{TAB}"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "^s"
WScript.Quit
FYI, for anyone still using Brett's & Brian's solution, here's my most recent modification for Remote Desktops (tsmmc) on Windows 7 (64-bit, in).
NOTE: The blanktsmmc file is no longer needed. tsmmc.csv format residing in same directory as VB script is still same, where desc, user, domain are optional (just leave as "server,,,"). The first line of each group is a bogus connection name used just for identifying the group. The ---,,, notates that a new RemoteDesktop group should be made:
---[GroupA]---,,,
server,desc,user,domain
server,desc,user,domain
---,,,
---[GroupB]---,,,
server,desc,user,domain
server,desc,user,domain
---,,,
---[GroupC]---,,,
server,desc,user,domain
server,desc,user,domain
' CreateTSMMC.vbs
' Script to re-create tsmmc entries in order
' Author: Brett Clarke http://twistingthewick.org
' Version: 0.1 – 21/06/2007
'
' Updated by Brian Travis, adding login and drive info
' Version: 0.2 - 2009-08-26
'
' Updated by Jack Hamilton, to make it work in Remote Desktops v5.2.3790.0
' Version: 0.3 - 2012-08-15
'
' Updated by Jack Hamilton, to allow more sleep on Remote Desktops launch
' to allow application to get focus before commands executed.
' Version: 0.4 - 2012-12-27
'
' Updated by Jack Hamilton for Windows 7. You cannot
' overwrite c:\windows\system32\tsmmc.msc, so added step at the end
' where user is prompted to Save As. User can then just execute
' using the new msc filename or create shortcut.
' Version: 0.5 - 2013-01-09
'
' NOTES:
' (1) If you get subscript out of range error, check your CSV for any blank lines
' or lines with too many commas and fix/delete them.
'
' (2) Be sure to close all programs before running, especially those like email
' or instant messaging that can pop up a notification window causing the
' window focus to change and thereby interrupt the automation process.
'
'———————————————————————
'Declare some variables
Option Explicit
Const ForReading = 1
Const Sleep_Long_Pause = 1000
Const Sleep_Between_Keys = 250
Dim objShell, objFSO, objFileCopy, objDictionary, objTextFile
Dim strWorkingMMC, strTemplate, strNextLine
Dim arrRDPList
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")
strWorkingMMC = "c:\windows\system32\tsmmc.msc"
strTemplate = ".\tsmmc.csv"
Set objTextFile = objFSO.OpenTextFile (strTemplate, ForReading)
' start up MMC
objShell.Run strWorkingMMC
' wait for the app to start
' NOTE: We need to have enough time for the
' Remote Desktops application to launch
' else MANY weird, bad things can happen
' if we don't have focus on the application
' else random commands start getting executed.
' Add more sleeps if app is slow to launch
' on this particular PC.
Wscript.Sleep (Sleep_Long_Pause * 5)
' get to the plugin
objShell.SendKeys "{DOWN}"
' read the CSV file, and parse the entries into the MMC session
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.ReadLine
arrRDPList = Split(strNextLine , ",")
if arrRDPList(0) = "---" Then
' create a new group
' Open File Menu
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "%f"
' Add/Remove Snap-In
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "m"
' Highlight Remote Desktops Snap-In
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "Remote Desktops"
' Add the highlighted available snap-in on left column
' over to the right-column
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "%a"
' Click OK
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{ENTER}"
' Move to bottom snap-in
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{END}"
' End create new group
Else
' Create new server connection
' Show Menu
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "+{F10}"
' Add Connection
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "A"
' IP/Hostname
Wscript.Sleep Sleep_Between_Keys
If arrRDPList(1) = "" Then
objShell.SendKeys arrRDPList(0)
Else
objShell.SendKeys arrRDPList(1)
End If
' Tab
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{TAB}"
' Username, Domain Info
Wscript.Sleep Sleep_Between_Keys
If arrRDPList(3) = "" Then
' Just Username, No Domain
objShell.SendKeys arrRDPList(2)
Else
' Username@Domain
objShell.SendKeys arrRDPList(2)
objShell.SendKeys "@"
objShell.SendKeys arrRDPList(3)
End If
' Tab
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{TAB}"
' Save Password
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys " "
' Tab
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{TAB}"
' Browse button (skip)
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{TAB}"
' Description
Wscript.Sleep Sleep_Between_Keys
If arrRDPList(1) = "" Then
objShell.SendKeys arrRDPList(0)
Else
objShell.SendKeys arrRDPList(1)
End If
' Skip "Connect to Console (w /admin option)"
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{TAB}"
' Click OK
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "{ENTER}"
' End create new server connection
end if
Loop
' Return to left-side column
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "+{TAB}"
' Open File Menu
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "%f"
' Open Save As to prompt user to save with new name.
Wscript.Sleep Sleep_Between_Keys
objShell.SendKeys "a"
' Quit Program
Wscript.Sleep Sleep_Between_Keys
WScript.Quit