次の方法で共有


Step by Step instructions for installing RDS Session Deployment using PowerShell in Windows Server 2012 R2

Hello AskPerf Readers! Dhiraj here from the Windows Performance team to talk about deploying RDS using Windows PowerShell on Windows Server 2012 R2.

As you know, PowerShell has been around for quite a few years now (November 2006 to be exact). Over the past 8 years, we have seen PowerShell become an integral part of Windows. One such example is deploying RDS within your environment. In this blog, we are going to walk you through setting this up. With that, let’s get rolling!

Before we begin though, we need to import the RDS module using the Import-Module cmdlet:

Import-Module RemoteDesktop

clip_image001

We will use the New-SessionDeployment cmdlet to begin with the installation. Below is the syntax for this cmdlet:

New-SessionDeployment [-ConnectionBroker] <string> [-WebAccessServer] <string> [-SessionHost] <string[]>

Note If you are installing the Session Host on the Connection Broker, then you need to run this cmdlet on a remote server, as running it on the connection Broker will give you the following error:

clip_image003

The Session Host role needs a reboot after the install, and we received the above error as PowerShell cannot resume the deployment after a reboot. However, this will work in the GUI if you do the same process.

In this deployment, we will use 3 servers for the deployment:

  • RDCBWA.spike.com – RD Connection Broker, RD Web Access, and RD Session Host
  • RDSH01.spike.com – Second RD Session Host
  • DC01.spike.com – RD license server

We will need to add RDSH01 and DC01 to All Servers pool on RDCBWA before we start the deployment.

clip_image005

Now we run the below cmdlet on RDSH01 to install RD Connection Broker, RD Web Access and RD Session Host on RDCBWA:

New-SessionDeployment –ConnectionBroker RDCBWA.spike.com –WebAccessServer RDCBWA.spike.com –SessionHost RDCBWA.spike.com

During the install, we’ll see the following progress meters:

1. Validation begins:

clip_image007

2. Deployment begins:

clip_image009

3. Connection Broker is installed:

clip_image011

4. RD Web Access role is installed:

clip_image013

5. RD Session Host role is installed:

clip_image015

6. After all roles are installed, the RDCBWA.spike.com server is restarted:

clip_image017

Once the PowerShell setup finishes, we now go to RDCBWA.spike.com and verify the installation. As you can see from the screenshot below, everything except the RD Gateway and Licensing server have been installed. We will now add another session host and a Licensing server.

clip_image019clip_image021

First, let’s add the second RD Session Host server to our deployment. We will use the Add-RDServer cmdlet and run it on the Connection Broker this time.

Add-RDServer -Server RDSH01.spike.com -Role RDS-RD-SERVER -ConnectionBroker RDCBWA.spike.com

When you run the above command, you will see the following progress:

clip_image023

clip_image025

clip_image027

clip_image029

RDSH01.spike.com is now rebooted:

clip_image031

We can now verify the addition of the second Session Host server in Server Manager:

clip_image032

We are now ready to add our Before proceeding, let’s configure RD Licensing server.for our deployment. To install RD licensing role, we use the below cmdlet:

Add-RDServer -Server DC01.spike.com -Role RDS-LICENSING -ConnectionBroker RDCBWA.spike.com

You will now see the below progress messages:

clip_image034

clip_image036

clip_image038

clip_image040

We now need to activate our License server and install CALs via the Licensing Manager GUI on the License server. I have activated the License Server and installed PerUser CALs.

Let’s configure our deployment for licensing. We use the below cmdlet for this:

Set-RDLicenseConfiguration -LicenseServer DC01.spike.com -Mode PerUser -ConnectionBroker RDCBWA.spike.com

Running the above cmdlet requires confirmation:

clip_image042

Select yes and continue.

When finished, it will return to the next line:

clip_image044

To confirm that licensing is configured, run the following cmdlet:

Get-RDLicenseConfiguration

clip_image046

We can now confirm everything in Server manager:

clip_image048

clip_image050

We are halfway done here and have completed the installation of our roles. We now need to configure RDS to make Desktop Sessions and RemoteApps available to users.

This takes us to the next step: creating a new collection using PowerShell.

We will create two collections here consisting each of the RDSH servers, with one for Desktop Sessions and the other for RemoteApps.

To create a new collection, we use the below cmdlet:

New-RDSessionCollection –CollectionName SessionCollection –SessionHost RDCBWA.spike.com –CollectionDescription “This Collection is for Desktop Sessions” –ConnectionBroker RDCBWA.spike.com

This also shows a progress bar and summary when it finishes:

clip_image052

clip_image054

We can verify this set up in Server Manager. As this collection is for Desktop Sessions, nothing else needs to be done.

clip_image055

Let’s go ahead with creating the second collection for RemoteApps:

New-RDSessionCollection –CollectionName RemoteAppCollection –SessionHost RDCBWA.spike.com –CollectionDescription “This Collection is for RemoteApps” –ConnectionBroker RDCBWA.spike.com

When it completes, we see the summary and collection in Server Manager:

clip_image056

clip_image057

As we will use this collection for publishing RemoteApps, Let’s go ahead with adding RemoteApp’s to it:

New-RDRemoteapp -Alias Wordpad -DisplayName WordPad -FilePath "C:\Program Files\Windows NT\Accessories\wordpad.exe" -ShowInWebAccess 1 -CollectionName "RemoteAppCollection" -ConnectionBroker RDCBWA.spike.com

Summary progress below:

clip_image059

clip_image061

Server Manager shows the RemoteApp added:

clip_image062

And with that, you are done! Users can now access the Desktop Session and Remote App Collections.

clip_image064

Windows Server 2012 R2 comes with enormous amount of PowerShell cmdlets. In this article we’ve only seen a few of them. We may dive deeper into the power of PowerShell for managing RDS for Server 2012 R2 in future posts.

If you are interested in setting up a VDI deployment using PowerShell, please check the link below:

Setting up a new Remote Desktop Services deployment using Windows PowerShell

-Dhiraj

Comments

  • Anonymous
    March 04, 2015
    Hello AskPerf Readers! Dhiraj here from the Windows Performance team to talk about deploying RDS using