Configure RDS Collections Using PowerShell
In today’s Ask the Admin, I’ll show you how to configure Remote Desktop Services (RDS) collections using Windows PowerShell.
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
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
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
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 Files\Windows NT\Accessories\wordpad.exe’ -ShowInWebAccess 1 -CollectionName PetriRemoteApps -ConnectionBroker srv1.ad.contoso.com
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.
More in Windows Server
Microsoft to Fix Windows Bug Breaking Wi-Fi hotspots After Installing Latest Patch Tuesday Update
Jun 17, 2022 | Rabia Noureen
Microsoft Confirms Windows Server Backup Issues in This Month's Patch Tuesday Updates
Jun 16, 2022 | Rabia Noureen
Microsoft Acknowledges Office Zero-Day Flaw Affecting Windows Diagnostic Tool
May 31, 2022 | Rabia Noureen
Microsoft Releases Out-Of-Band Patches to Fix Windows AD Authentication Issues
May 20, 2022 | Rabia Noureen
CISA Warns Windows Admins Against Applying May Patch Tuesday Updates on Domain Controllers
May 17, 2022 | Rabia Noureen
Microsoft Confirms May 2022 Patch Tuesday Updates Cause AD Authentication Issues
May 12, 2022 | Rabia Noureen
Most popular on petri