Deploy Windows 2016 RDS with PowerShell

Please refer to the steps below on how to deploy Windows 2016 RDS with PowerShell

Lab Machine (VM) prepared
* Windows 2016 RDS Server (All in One) – MDT-RDS.mymdt.local (192.168.1.236)

  1. Enable RDS Role from 1 of the Windows 2012R2/2016 Domain Joined Server
Import-Module RemoteDesktop

New-RDSessionDeployment -ConnectionBroker MDT-RDS.mymdt.local -WebAccessServer MDT-RDS.mymdt.local -SessionHost MDT-RDS.mymdt.local -Verbose
#VERBOSE: The deployment was successful.

You will get the followng error message if you run the above PowerShell Script locally on the RDS Server

  1. Restart the RDS Server
Restart-Computer
  1. Enable RDS Licensing Server on MDT-RDS Server and do NOT point the RDS Session Host to the Licensing Server for now
#RDS Licensing Server
Add-WindowsFeature -Name RDS-Licensing, RDS-Licensing-UI
  1. We are using Trial License in this lab – RDS Session Host will have 120 Days Grace Period prior pointing to RDS Licensing Server

You can check how many days remaining for your Grace Period with

wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TerminalServiceSetting WHERE (__CLASS !="") CALL GetGracePeriodDays

  1. Create Session Collection for RDS Session Host – Pooled Desktop Session called UAT with Description

A Session Collection holds the apps and desktops you want to make available to users. pooled desktop sessions or personal desktop sessions can be configured

New-RDSessionCollection –CollectionName UAT –SessionHost MDT-RDS.mymdt.local –CollectionDescription “UAT for Session Host” –ConnectionBroker MDT-RDS.mymdt.local

There is several options that you can configured for Session Collection, for instance assigned multiple users group to access to this Session Collection

$UserGroup =@("MYMDT\Domain Users","MYMDT\Administrator")
Set-RDSessionCollectionConfiguration -CollectionName UAT -UserGroup $UserGroup

Please refer to the link below for detail configuration availble with PowerShell
https://docs.microsoft.com/en-us/powershell/module/remotedesktop/set-rdsessioncollectionconfiguration?view=win10-ps

  1. Publish Application to the Session Collection for users to access

Check the availble Application availbles in RDS Host

Get-RDAvailableApp -CollectionName UAT

DisplayName                    FilePath                                                          CommandLineArguments
-----------                    --------                                                          --------------------
Windows Defender               C:\Program Files\Windows Defender\MSASCui.exe                                         
Task Manager                   C:\Windows\system32\taskmgr.exe                                   /7                  
Google Chrome                  C:\Program Files (x86)\Google\Chrome\Application\chrome.exe                           
Brackets                       C:\Program Files (x86)\Brackets\Brackets.exe                                 

Publish WordPad & Caculator

New-RDRemoteapp -Alias WordPad -DisplayName WordPad -FilePath "C:\Program Files\Windows NT\Accessories\wordpad.exe" `
-ShowInWebAccess 1 -CollectionName "UAT" -ConnectionBroker MDT-RDS.mymdt.local

New-RDRemoteapp -Alias Calculator -DisplayName Calculator -FilePath "C:\Windows\system32\win32calc.exe" `
-ShowInWebAccess 1 -CollectionName "UAT" -ConnectionBroker MDT-RDS.mymdt.local
  1. Login RDS Web via https://192.168.1.236/RDWeb with Domain\USERNAME and Password

WordPad & Caculator are published

Leave a Comment