Configure RDS Collections Using PowerShell RDS Commands

powershell hero

 

 

Configure RDS Collections Using PowerShell RDS Commands


In today’s Ask the Admin, I’ll show you how to configure Remote Desktop Services (RDS) collections using Windows PowerShell and the essential PowerShell RDS commands.

In Configure RDS Collections in Windows Server 2012 R2, I showed you how to configure collections using Server Manager. RDS collections are groups of RD Session Host servers with a shared set of RemoteApps, session host or VDI desktops that can be published to users. For information on RDS, see Remote Desktop Services Deployment Options in Windows Server 2012 R2 on the Petri IT Knowledgebase.

Create a new collection with PowerShell RDS Commands

To complete the instructions below, log in to the RD Connection Broker using an account that has permission to manage RDS.

Open a PowerShell prompt from the taskbar or Start menu, and then use the New-RDSessionCollection cmdlet to create a new collection. In the example below, I’ve given the collection a name, a description, and specified the RDS Session Host and Connection Broker servers using their fully qualified domain names (FQDNs). In your environment, you will need to replace these values as appropriate.

New-RDSessionCollection –CollectionName PetriDesktops –SessionHost srv1.ad.contoso.com –CollectionDescription ‘Desktop sessions’ –ConnectionBroker srv1.ad.contoso.com
Create a new Remote Desktop Services (RDS) collection using the New-RDSessionCollection PowerShell cmdlet (Image Credit: Russell Smith)
Create a new Remote Desktop Services (RDS) collection using the New-RDSessionCollection PowerShell cmdlet (Image Credit: Russell Smith)

To verify the creation of the new collection, use the Get-RDSessionCollection cmdlet, replacing srv1.ad.contoso.com with the name of your RDS Connection Broker.

Get-RDSessionCollection –ConnectionBroker srv1.ad.contoso.com

To remove a collection from an RDS Connection Broker, use the Remove-RDSessionCollection cmdlet as shown here, again replacing the values for -CollectionName and -ConnectionBroker as needed for your environment. Once you’ve run the command, you’ll need to confirm the operation by typing Y and pressing ENTER.

Remove-RDSessionCollection –CollectionName PetriDesktops –ConnectionBroker srv1.ad.contoso.com

Create a collection for RemoteApps using PowerShell RDS Commands

Now let’s create a second collection for a RemoteApp, Wordpad in this example. Because I only have one RDS Session Host in this deployment, it was necessary to delete the previous collection because RDS Session Hosts can only participate in one collection at a time. The New-RDSessionCollection cmdlet below is the same as the one above, apart from the -CollectionName and -CollectionDescription, which are different:

New-RDSessionCollection –CollectionName PetriRemoteApps –SessionHost srv1.ad.contoso.com –CollectionDescription ‘Remote Apps’ –ConnectionBroker srv1.ad.contoso.com

Now we need to add an app to the collection using the New-RDRemoteApp cmdlet:

New-RDRemoteApp -Alias Wordpad -DisplayName WordPad -FilePath ‘C:Program FilesWindows NTAccessorieswordpad.exe’ -ShowInWebAccess 1 -CollectionName PetriRemoteApps -ConnectionBroker srv1.ad.contoso.com
Add a new RemoteApp to an RDS collection using the New-RDRemoteApp PowerShell cmdlet (Image Credit: Russell Smith)
Add a new RemoteApp to an RDS collection using the New-RDRemoteApp PowerShell cmdlet (Image Credit: Russell Smith)

To see the list of apps in the collection, use the Get-RDRemoteApp cmdlet, replacing the -ConnectionBroker and -CollectionName parameters values for your environment:

Get-RDRemoteApp -ConnectionBroker srv1.ad.contoso.com -CollectionName PetriRemoteApps

To remove an app from a collection, use the Remove-RDRemoteApp cmdlet, and confirm the operation when prompted.

Remove-RDRemoteApp -Alias Wordpad -CollectionName PetriRemoteApps -ConnectionBroker srv1.ad.contoso.com

In this article, I showed you how to create, enumerate, and remove collections from RDS Connection Brokers, and how to add and remove RemoteApps to collections using PowerShell RDS Commands.

FAQs

How do PowerShell RDS Commands handle load balancing across multiple RD Session Host servers?

PowerShell RDS Commands offer specific tools for distributing workloads through the Set-RDSessionCollectionConfiguration cmdlet. System administrators can assign different weight values to servers and establish connection limits, which creates balanced resource allocation throughout the RDS environment. These settings help maintain steady performance and prevent individual servers from becoming overloaded.

Can PowerShell RDS Commands be used to manage user sessions and set time limits?

PowerShell RDS Commands include Set-RDSessionHostConfiguration and Set-RDLicenseConfiguration cmdlets that provide precise control over session parameters. IT teams can set specific timeframes for idle disconnection, define maximum session lengths, and manage reconnection windows. These settings work alongside RDS licensing requirements to maintain proper system operations.

How do PowerShell RDS Commands integrate with Azure Virtual Desktop (AVD)?

Microsoft supplies additional modules that connect PowerShell RDS Commands with Azure Virtual Desktop services. Administrators who manage both local RDS systems and cloud-based virtual desktops can use similar PowerShell instructions across their entire infrastructure, streamlining management tasks through unified command structures.

What security features can be configured using PowerShell RDS Commands?

PowerShell RDS Commands include Set-RDCertificate and Set-RDClientAccessName cmdlets for implementing security measures. These tools handle SSL certificate assignments, configure network authentication protocols, and manage gateway server settings. Such features create strong protection layers for RDS deployments.

How can PowerShell RDS Commands assist with troubleshooting and monitoring?

System administrators use Get-RDDiagnosticActivities and Get-RDUserSession cmdlets from PowerShell RDS Commands to identify and fix issues. These tools track current sessions, record user activities, and create detailed reports that help maintain optimal system performance through data-driven improvements.