Tag Archives: PowerShell Remote Desktop GUI

Create a PowerShell GUI application to perform remote desktop operation using Microsoft Remote Desktop ActiveX control

PowerShell RDC
PowerShell Remote Desktop Client

In order to get the Remote Desktop Client to function in a .NET project you must obtain the Remote Desktop ActiveX control wrapper (MSTSCLib.dll and AxMSTSCLib.dll).

You may need to unblock the files, since they were downloaded from internet.
File –> Right click –> Properties

Unblock File
Unblock File Downloaded from Internet

Create PowerShell Winform and add Panel control. Additionally add buttons for connect, disconnect, refresh, etc.

Load into your PowerShell script both ActiveX component assemblies:

where $dllpath is the location of the files.
Create new Object type and add it to the form Panel control:

Create new on-click event for button “Connect” and fill in the RDP client properties:

Click here for the Microsoft Remote Desktop ActiveX control client settings reference.