Shadow RDS Session PS Script for Helpdesk Staff

I wrote this PowerShell script so that our Helpdesk staff were able to view the Remote Desktop Sessions on our 2012 RDS Hosts and shadow them.

The script queries the RDS farm with Get-RDUserSession by invoking this command on your Mangement Server (that has the RDS Tools installed), then starts mstsc with the appropriate session ID and Session Host.


The main gist of it is in these two lines….

$result = invoke-command -computer "DomainController" -scriptblock {Get-RDUserSession -ConnectionBroker "ConnectionBroker" | Select-Object -Property Username,HostServer,UnifiedSessionID} -Credential $credentials

Start-Process mstsc -Credential $credentials -ArgumentList "/shadow: $($newResult.UnifiedSessionId) /control /v: $($newResult.HostServer) /noConsentPrompt"

However I’ve wrapped up the results into a little GUI and have a nice connect button to make it as easy as possible for helpdesk staff.



Total Views: (294)

Leave a Reply

Your email address will not be published. Required fields are marked *

Connect with Facebook