Powershell GUI – Easily Control RDP Sessions in a collection

The problem: I didn’t want to have to open up server manager and add the connection broker just to remote into users. I needed something seamless.

The script/solution:

Because out-gridview with -passthru is the coolest powershell command in the freaking world!

import-module remotedesktop
$cbserver = "yourconnectionbroker.domain.local"
$id = get-rdusersession -ConnectionBroker $cbserver | Out-GridView -title "RD Connection" -PassThru | select hostserver, unifiedsessionid
$id2 = $id | select -ExpandProperty unifiedsessionid
$srv = $id | select -ExpandProperty hostserver
mstsc /v:"$srv" /shadow:"$id2" /control /noconsentprompt

Remeber to replace yourconnectionbroker.domain.local with your actual server.

Vrico, how does it work? Let me show you.

img 57e1ffa6b4409

Once I’ve selected a user from the list, I press OK.

credits to Eli for thinking of a problem that needed a solution.

Leave a comment

Exit mobile version