0

I'm trying to manage user sessions across 10+ 2012 R2 RDSH Hosts inside a vWorkspace 8.6.1 Farm without a 2012 R2 Connection Broker Role.

I am concerned that adding the Connection Broker, creating a pool, and adding servers to it will interfere with the policy settings and load balancing rules setup in vWorkspace (two drivers, one car). And the vWorkspace controls are not intuitive enough to deploy to tier 1 support and somewhat clunky.

This wasn't a problem in 2008 and previous versions but now Microsoft has replaced all the previous standalone tools and seemingly forced their Server Manager / Connection Manager role setup.

Looking for a powershell script (or other) option to manage user logoffs, shadowing sessions, etc (across the pool) that doesn't reference a connection broker. Most scripts / tools for powershell now reference a Collection: TechNet Get-RDUserSession

Get-RDUserSession -ConnectionBroker "rdcb.contoso.com"

0

1 Answer 1

1

You can actually use Get-RDUserSession for this task. Just refer to the collectionname, not to the connectionbroker

Get-RDUserSession -collectionname "Mycollection" | ft Username, UnifiedSessionId

this will get you the session IDs of all RDP connections

then you can shadow those with this command (in this example, sessionid "3" is shadowed)

Mstsc /shadow:3 /control

To make your life easier you could use a function that looks for the UserName.

function ShadowSession([string]$UserName, [string]$CollectionName)
{
    $SessionID = Get-RDUserSession -collectionname $CollectionName |
        select UnifiedSessionId | ? {$_.Username -eq $UserName}
    mstsc /shadow:$SessionID /control
}

so you command would be

ShadowSession -UserName "User01" -CollectionName "MyCollection"

if you have only one RDS collection use this

function ShadowSession([string]$UserName)
{
    $SessionID = Get-RDUserSession -collectionname "MyCollection" |
        select UnifiedSessionId | ? {$_.Username -eq $UserName}
    mstsc /shadow:$SessionID /control
}

then you don't have to refer to the collectionname, only the username

ShadowSession -UserName "User01"

You can even go further and add switches to your function

then you could use this function for everything you want. shadowing, logging off, etc.

5
  • I may be making some wrong assumptions but from what I've seen, you have to have a connection broker in order to have a collection. And if you have a collection you have a base level of policies assigned to it. I could install the Microsoft CB role on my vWorkspace Connection Brokers strictly for the purposes of making a collection, but I see this as annoying redundancy or worse overlapping policy behavior.
    – PlainJay
    Mar 6, 2016 at 16:51
  • @PlainJay Ok. I didn't know that. Can you run get-rdusersession on one of your Hosts? this command needs powershell run as administrator and also the remote desktop module import-module remotedesktop. You can run the command without the collectionname parameter
    – SimonS
    Mar 6, 2016 at 19:37
  • Unfortunately it doesn't appear that you can: get-rdusersession : A Remote Desktop Services deployment does not exist on (computer name). This operation can be performed after creating a deployment. For information about creating a deployment, run "Get-Help New-RDVirtualDesktopDeployment" or "Get-Help New-RDSessionDeployment". At line:1 char:1 + get-rdusersession user1 + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-RDUserSession
    – PlainJay
    Mar 7, 2016 at 20:40
  • When you run help on New-RDSessionDeployment it tells you that you need a RDWeb Role server, CB Role Server, etc.. for a new deployment. Ugh.
    – PlainJay
    Mar 7, 2016 at 20:42
  • @PlainJay ok, well i guess if you don't want to create this roles (cb etc.) then you need to stick with the old batch commands. just refer to the answer of "lkm0513" in this thread: community.spiceworks.com/topic/… . i'd suggest to try creating a server farm with CB etc.
    – SimonS
    Mar 8, 2016 at 8:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .