This scenario is probably not the most common, but I experienced it at a customer recently where they had the ConfigMgr console installed on a number of Terminal Servers. Unfortunately, DNS was not used broadly and instead on many of their systems they relied heavily on hosts files and by IP addresses. In this case, most of the right-click tools that I’ve seen up until today use the NetBIOS or DNS name when they initiate their functions, but that’s not an option here. The customer wanted to be able to right-click on a device in the console and start a Remote Desktop Connection session, so I thought that I’d rely on what the ConfigMgr clients had inventoried. If you’d right click on a device in the console and select Properties, you’ll see that there’s a bunch of IP addresses available (assuming the everything is working properly).
How can we then use this information that is available to start a Remote Desktop Connection session? We can create a small Windows Forms PowerShell script that contains the logic necessary to get the IP address information from a specific device to start mstsc.exe.
Download the script
I’ve uploaded the script to the TechNet Gallery, and it’s available here. Download this script and put it on the site server or stand-alone server where you’re launching the ConfigMgr console from. I’ve chosen to store it in:
Extend the ConfigMgr console
Since this tool purpose is for admins right-clicking on a device, we’d need to extend the ConfigMgr console in the Devices and Device Collections nodes. This can easily be done by creating the following two folders named:
in the following location:
<ConfigMgr Admin Console installation path>\AdminConsole\XmlStorage\Extensions\Actions
In both of these folders, create a new XML file called StartRDP.xml. The XML file should contain the following:
<ActionDescription Class="Executable" DisplayName="Start Remote Desktop" MnemonicDisplayName="Start Remote Desktop" Description="v" SqmDataPoint="53"> <ShowOn> <string>ContextMenu</string> </ShowOn> <ResourceAssembly> <Assembly>AdminUI.CollectionProperty.dll</Assembly> <Type>Microsoft.ConfigurationManagement.AdminConsole.CollectionProperty.Properties.Resources.resources</Type> </ResourceAssembly> <ImagesDescription> <ResourceAssembly> <Assembly>AdminUI.UIResources.dll</Assembly> <Type>Microsoft.ConfigurationManagement.AdminConsole.UIResources.Properties.Resources.resources</Type> </ResourceAssembly> <ImageResourceName>RemoteDesktopClient</ImageResourceName> </ImagesDescription> <Executable> <FilePath>"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"</FilePath> <Parameters>-windowstyle hidden -executionpolicy bypass -file "C:\Scripts\Start-RDPFromIP.ps1" -SiteServer "##SUB:__Server##" -ResourceID "##SUB:ResourceID##"</Parameters> </Executable> </ActionDescription>
At the 3rd row from the bottom of the XML file, notice that there’s a <Parameters> section where a path to the script file is specified. This needs to be amended so that it reflects to location of where you’ve downloaded the script.
Using the tool
Close the ConfigMgr console if you have it open, and start it again. If you now go into one of the Devices or Device Collections nodes, right-clicking on one of the devices, you’ll see that there’s a new option at the bottom called Start Remote Desktop.
If you select that option, a small Windows Forms window will launch and based on what IP addresses are stored for the selected device in WMI, the results will be shown in the drop down list menu.
Once you select any of the IP addresses, the Select button will be enabled.
When you click the Select button, mstsc.exe will launch trying to initiate a Remote Desktop Connection session to the chosen IP address.
Pretty cool huh? I realize that this is probably not a tool that will be used widely, but in some environment it may be suitable for various reasons.