MSEndpointMgr
Home » Microsoft Endpoint Manager » ConfigMgr » Console Extension – Start Remote Desktop Connection based upon a Device IP address

Console Extension – Start Remote Desktop Connection based upon a Device IP address

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:
C:\Scripts

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:
ed9dee86-eadd-4ac8-82a1-7234a4646e62
3fd01cd1-9e01-461e-92cd-94866b8d1f39
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.
94_1
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.
94_2
Once you select any of the IP addresses, the Select button will be enabled.
94_3
When you click the Select button, mstsc.exe will launch trying to initiate a Remote Desktop Connection session to the chosen IP address.
94_4
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.

(688)

Nickolaj Andersen

Chief Technical Architect and Enterprise Mobility MVP since 2016. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows devices and deployments including automation. Awarded as PowerShell Hero in 2015 by the community for his script and tools contributions. Creator of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService to name a few. Frequent speaker at conferences such as Microsoft Ignite, NIC Conference and IT/Dev Connections including nordic user groups.

3 comments

  • Hi, thanks for the grat tip. Just one question, is it possible to apply to MDT? I would like to map the RDP button in monitoring section to IP address instead of hostname and add a VNC button (WinPe phase). Thanks again to share.
    Andrea

  • Thanks my friend. Worked out fine. This will be helpful for me in the next project on Win 7 migration. I can share this to my Tech support and make their life a lot easier to connect and fix user support ticket.
    Ram

Sponsors

Subscribe

Do you want to be notified of new posts on our site?

Please enter your email address below:

Categories

MSEndpointMgr.com use cookies to ensure that we give you the best experience on our website.