Deploy Remote Desktop Services using PowerShell
In today’s Ask the Admin, I’ll show you how to deploy Remote Desktop Services in Windows Server 2012 R2 using PowerShell.
In a previous Ask the Admin, Installing Remote Desktop Services in Windows Server 2012 R2, I demonstrated how to deploy Remote Desktop Services (RDS) using the standard deployment model. For more information on the RDS components and deployment models, take a look at Remote Desktop Services Deployment Options in Windows Server 2012 R2 on the Petri IT Knowledgebase.
Deploy RDS using PowerShell
Servers that you want to use in your deployment need to be added to the Server Pool in Server Manager before you start the process below. For more info, see Managing Windows Server 2012 with Server Manager on Petri. You’ll need an Active Directory domain and an account that has permission to install the server roles on your chosen server(s). The RD Connection Broker role can’t be installed on a domain controller, and installation should not be carried out on the server where the RD Connection Broker role will be installed.
- Log into the Windows Server 2012 R2 server where you want to run the PowerShell cmdlets. The account should have administrative access to the server(s) where the RDS roles will be installed.
- Open a PowerShell prompt from the taskbar or Start screen.
- In the PowerShell window, type Import-Module RemoteDesktop and press ENTER.
- To install the three compulsory RDS components in a standard deployment, use the New-SessionDeployment cmdlet as shown below, replacing the values for the -ConnectionBroker, -WebAccessServer, and -SessionHost parameters with the name(s) of the servers on which you want to install these roles.
New-SessionDeployment -ConnectionBroker srv1.ad.contoso.com -WebAccessServer srv1.ad.contoso.com -SessionHost srv1.ad.contoso.com
If you want to manage the new deployment using Server Manager, you’ll need to add the server where the RD Connection Broker role is installed to the Server Pool and then click Remote Desktop Services in the list of options on the left of Server Manager. For more information on working with Server Manager, see Managing Windows Server 2012 with Server Manager on Petri.
If you want to add an additional RD Session Host or RD Licensing, you can use the Add-RDServer cmdlet as shown below:
Add-RDServer -Server srv1.ad.contoso.com -Role RDS-RD-SERVER -ConnectionBroker
You should specify an existing RD Connection Broker server, although it is also possible to add an additional Connection Broker to your deployment (maximum 2), and the -Role parameter value should be set to RDS-RD-SERVER to install a RD Session Host, or RDS-LICENSING to install the RD Licensing role.
If you opt to install RD Licensing, you’ll need to use the management console on the licensing server to activate the server and install your licenses from Microsoft. Once you have done that, you can use PowerShell to associate the new license server with your existing Connection Broker using the Set-RDLicenseConfiguration cmdlet. The -Mode parameter can be set to PerDevice or PerUser. Select ‘Y’ for yes to confirm the operation.
Set-RDLicenseConfiguration -LicenseServer srv1.ad.contoso.com -Mode PerUser -ConnectionBroker srv1.ad.contoso.com
In the next article in this series, I’ll show you how to configure RDS collections so you can get started publishing RemoteApps.
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