VMM Service Deployment: Deploying a Scale-Out RDS as a Service – Part 1 #SCVMM #CloudOS #HyperV #SysCtr #PrivateCloud

This post was edited/updated on 22/November/2014.

The update affect section (c) RDCB Application Profile Third Tier where I included 4 additional PowerShell scripts that set the RD File Type Association for the published Apps!

In this series of blog posts, I will show you step by step how to use only System Center Virtual Machine Manager 2012 R2 to deploy a Scale-Out Remote Desktop Services (RDS) service deployment.

Introduction to Service Templates:

Service Templates allow us to rapidly deploy a pre-configured services (application), consisting of one or more virtual machines, managed as a single entity, which can be scaled-out to match service demand. A simple example may be a two tiered application consisting of a SQL Server, and a load balanced web server. As demand for the application increases, the web interface may be scaled-out into a three or four NLB cluster. As demand decreases, the service can be scaled-in to the initial two nodes cluster.

Service Templates are configured through the use of many VMM resources such as virtual hard disks, VM Templates, Guest OS profiles, Hardware profiles, and other VMM library resources. The service template allows us to configure how many Virtual Machines are initially deployed as part of the service deployment, then configure the applications to be installed at deployment time, as well as to configure other scripts to be executed throughout the deployment. Finally, the service templates allow us to define thresholds or minimum and maximum instance sizes at which the service can be scaled.

And remember that IT is all about Service!

Scenario

In Part I this post, we will create three tier RDS service consisting of a Remote Desktop Connection Broker (RDCB) Server, Remote Desktop Web Access (RDWA) web server, and Remote Desktop Session Host (RDSH) server. As I mentioned earlier, as demand for the application increases, the remote session host server (RDSH) may be scaled-out into two or three instances. As demand decreases, the service can be scaled-in to the initial one session host server.

In Part II next post, I will be detailing how to create the service template design.

In Part III last post, I will be detailing how to deploy the service template to a cloud.

Ok, so having this explained and without further ado, let’s start the service deployment plan:

RDS Service Deployment Prerequisites

I will begin detailing how this service template has been configured. This post is all about pulling together the prerequisites. In order to achieve a service deployment similar to the scenario that I am working with, the following items will be required:

1. Virtual Hard Disk with Windows Server 2012 R2 Standard fully updated generalized and ready for deployment.
2. Virtual Hard Disk with Windows Server 2012 R2 Standard fully updated including Office 2013 generalized and ready for deployment.
3. VM Template for each VHDX.
4. Guest OS Profiles including necessary information for the deployment.
5. Hardware Profiles including necessary information for the deployment.
6. Application Profiles including the commands/scripts required for creating the RDS deployment.

During the next few sections, I will be detailing each of the 6 prerequisites.

The RDS service deployment detailed in this blog series consist of three different VM tiers.

  • Tier One (RDCB01): Remote Desktop Connection Broker (RDCB), this is required and core component for the RDS deployment.
  • Tier Two (RDWA01): Remote Desktop Web Access (RDWA), this is required to publish the remote applications to the users.
  • Tier Three (RDSH01->RDSH05): Scale-Out Remote Desktop Session Host (RDSH), this is required to host users’ sessions.

Because of the RemoteApp requirements, I have chosen to use two different Virtual Hard drives, one for RDCB and RDWA and the second for RDSH tier. There are other ways that could be performed using only one hard drive and a scripted office installation through Configuration Manager (SCCM) or App-V, however the method detailed here works very well and without the need for any additional infrastructure.

1- Tier 1 (RDSH) Source: The following steps were used to complete this task:

  • Deployed a Standard Generation 1 VM with Windows Server 2012 R2
  • Install Office 2013 x64 SP2
  • Applied all software updates
  • Powered off the VM
  • Used the SCVMM create template from existing machine capabilities to create both a virtual hard drive from the VM as well as a VM Template

2- Tier 2 & Tier 3 (RDWA/RDCB) Source: I’ve prepared the source VM with a SYSPREP copy of Windows Server 2012 R2. The following steps were used to complete this task:

  • Deploy Standard Generation 1 VM with Windows Server 2012 R2
  • Applied all software updates
  • Powered off the VM
  • Used the SCVMM to create template from existing machine capabilities to create both a virtual hard drive from the VM as well as a VM Template

After completing these tasks, we have two VHDX files in my VMM Library and also two VM Templates which takes care of the first three deployment prerequisites.

4- VMM Guest OS Profile

I will create 3 guest OS profiles one for each tier with the following information:

Identity Information: @RDCB@ – VMM support use of variables, # OR @ sign, the # sign is for creating incremental series of virtual machines 01, 02, 03… and the @ sign is a variable, so when we go to deploy this service template, then is going to asks us to populate the server host name with an actual host name, I also need this because later on, I have to know what is the computer host name is in order to put together all the PowerShell scripts that are going to allow me to create the RDS service deployment and configuration.

Roles and Features: Remote Desktop Services, Remote Desktop Connection Broker, and Remote Desktop Licensing Roles.

Domain: Joined to Domain.

VMM-ScaleOut-RDS01

Identity Information: @RDWA@

Roles and Features: Remote Desktop Services, and Remote Desktop Web Access Roles.

Domain: Joined to Domain.

VMM-ScaleOut-RDS02

Identity Information: RDSH##, the ## sign is for creating incremental series of RDSH VMs 01->05.

Roles and Features: Remote Desktop Services, and Remote Desktop Session Host Roles.

Domain: Joined to Domain.

VMM-ScaleOut-RDS03

So what we did here, I selected the prerequisites requirement for each host tier, so when it comes time to deploy this service, those Roles will get installed as part of the deployment.

After completing these tasks, we have three Guest OS profiles in VMM Library which takes care of the fourth prerequisite on the list.

5- VMM Hardware Profiles

I will create 3 hardware profiles one for each tier with the following information:

Small VM Hardware Profile will be used for the Remote Desktop Connection Broker (RDCB) tier.

Important point to remember that all hardware profiles must be created using Generation 1 VM, because VMM 2012 R2 does not support Generation 2 VM as service template, and most likely this could be changed in the next VMM release.

VMM-ScaleOut-RDS04

Medium VM Hardware Profile will be used for the Remote Desktop Web Access (RDWA) tier.

VMM-ScaleOut-RDS05

High VM Hardware Profile will be used for the Remote Desktop Session Host (RDSH) tier.

VMM-ScaleOut-RDS06

What we did here, I created three different hardware profiles to be used for each host tier, so when it comes time to deploy this service, then each VM will be configured accordingly.

After completing these tasks, I have three Hardware profiles in my VMM Library which takes care of the fifth prerequisite on the list.

6- Application Profiles

This is the last and the longest exciting prerequisite, we know that we need to do some upfront work in order to automate the whole RDS service deployment.

I will create 3 application profiles with the following scripts:

(a) RDSH Scale-Out / Scale-In Application Profile

First VM When Created 1: cmd.exe Parameters: /q /c shutdown /r /t 0
First VM When Created 2: %WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe Parameters: -command Set-ExecutionPolicy Bypass –Force

Other VMs When Created 1: %WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe Parameters: -command Add-RDServer -Server @ComputerName@ -ConnectionBroker @RDCB@.domain.NET -Role RDS-RD-SERVER
Other VMs When Created 2: %WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe Parameters: -command Add-RDSessionHost -CollectionName @CollectionName@ -SessionHost @ComputerName@ -ConnectionBroker @RDCB@.domain.NET

Other VMs When Deleted 1: %WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe Parameters: -command Remove-RDSessionHost -SessionHost @ComputerName@ -ConnectionBroker @RDCB@.domain.NET –Force
Other VMs When Deleted 2: %WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe Parameters: -command Remove-RDServer -Server @ComputerName@ -ConnectionBroker @RDCB@.domain.Net -Role RDS-RD-SERVER -Force

Basically what I am doing in First VM When Created 1, I am rebooting the Virtual Machine, because the RDS roles when they are installed, if you recall last time you installed Remote Desktop Services, what have to happen after the installation? you had to actually reboot the computer. So I am forcing the reboot here in order to continue with the remaining scripts.

As for First VM When Created 2, I am setting the execution policy to Bypass mode, so any kind of PowerShell commandlet that will run later that has (Press the [Y] to continue), is going to just automatically continue without waiting.

Now will move to Scale-Out two scripts, what is changed in the command type (Other VMs When Created): Those two scripts will run only when you Scale-Out this tier (Add VM instances).

The last two scripts are for Scale-In this tier (Other VMs When Deleted): Those two scripts will run only when you Scale-In this tier (Delete VM instances).

If you noticed, there is one special variable in VMM @ComputerName@, as you can guess, the ComputerName variable will just simply give you the fully qualified domain name of the computer that the variable is executing on. The ComputerName variable is important here, because we may not necessary know what that machine name is going to be, it can be RDSH02, RDSH03, 04 or up to 99, so by using the computer name variable here, it doesn’t matter what the name of the machine is, simply take this machine and add it to an RDS deployment.      

VMM-ScaleOut-RDS07

(b) RDWA Application Profile Second

First VM When Created 1: cmd.exe Parameters: /q /c shutdown /r /t 0
First VM When Created 2: %WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe Parameters: -command Set-ExecutionPolicy Bypass -Force

I am forcing the reboot of the RDWA virtual machine tier, and then set the execution policy to bypass.

VMM-ScaleOut-RDS08

(c) RDCB Application Profile Third Tier

Last but not least, RDCB application profile that has all the building block series of scripts in order to interconnect the three RDS instances.

First VM When Created 1: cmd.exe Parameters: /q /c shutdown /r /t 0
First VM When Created 2: %WINDIR%\System32\WindowsPowerShell\v1.0\PowerShell.exe Parameters: -command Set-ExecutionPolicy Bypass -Force
First VM When Created 3: -command New-RDSessionDeployment -ConnectionBroker @RDCB@.domain.NET -WebAccessServer @RDWA@.domain.NET -SessionHost RDSH01.domain.NET
First VM When Created 4: -command New-RDSessionCollection -CollectionName @CollectionName@ -SessionHost RDSH01.domain.NET -ConnectionBroker @RDCB@.domain.NET
First VM When Created 5: -command Set-RDLicenseConfiguration -Mode PerDevice -ConnectionBroker @RDCB@.domain.NET -LicenseServer @RDCB@.domain.NET
First VM When Created 6: -command New-RDRemoteApp -Alias POWERPNT -DisplayName ‘PowerPoint2013’ -FilePath ‘C:\Program Files\Microsoft Office\Office15\POWERPNT.exe’ -ShowInWebAccess 1 -CollectionName @CollectionName@ -ConnectionBroker @RDCB@.domain.NET
First VM When Created 7: -command New-RDRemoteApp -Alias WINWORD -DisplayName ‘Word2013’ -FilePath ‘C:\Program Files\Microsoft Office\Office15\WINWORD.exe’ -ShowInWebAccess 1 -CollectionName @CollectionName@ -ConnectionBroker @RDCB@.domain.NET
First VM When Created 8: -command New-RDRemoteApp -Alias EXCEL -DisplayName ‘Excel2013’ -FilePath ‘C:\Program Files\Microsoft Office\Office15\EXCEL.exe’ -ShowInWebAccess 1 -CollectionName @CollectionName@ -ConnectionBroker @RDCB@.domain.NET
First VM When Created 9: -command New-RDRemoteApp -Alias AcroRd32 -DisplayName ‘AdobeReaderXI’ -FilePath ‘C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe’ -ShowInWebAccess 1 -CollectionName @CollectionName@ -ConnectionBroker @RDCB@.domain.NET
First VM When Created 10: -command $FileExtensions = Get-RDFileTypeAssociation -CollectionName @CollectionName@ -AppAlias POWERPNT ; Foreach ($File in $FileExtensions) { Set-RDFileTypeAssociation -CollectionName @CollectionName@ -AppAlias POWERPNT -FileExtension $File.FileExtension -IsPublished $True -IconPath ‘C:\Program Files\Microsoft Office\Office15\POWERPNT.exe’ -IconIndex 0 }
First VM When Created 11: -command $FileExtensions = Get-RDFileTypeAssociation -CollectionName @CollectionName@ -AppAlias WINWORD ; Foreach ($File in $FileExtensions) { Set-RDFileTypeAssociation -CollectionName @CollectionName@ -AppAlias WINWORD -FileExtension $File.FileExtension -IsPublished $True -IconPath ‘C:\Program Files\Microsoft Office\Office15\WINWORD.exe’ -IconIndex 0 }
First VM When Created 12: -command $FileExtensions = Get-RDFileTypeAssociation -CollectionName @CollectionName@ -AppAlias EXCEL ; Foreach ($File in $FileExtensions) { Set-RDFileTypeAssociation -CollectionName @CollectionName@ -AppAlias EXCEL -FileExtension $File.FileExtension -IsPublished $True -IconPath ‘C:\Program Files\Microsoft Office\Office15\EXCEL.exe’ -IconIndex 0 }
First VM When Created 13: -command $FileExtensions = Get-RDFileTypeAssociation -CollectionName @CollectionName@ -AppAlias AcroRd32 ; Foreach ($File in $FileExtensions) { Set-RDFileTypeAssociation -CollectionName @CollectionName@ -AppAlias AcroRd32 -FileExtension $File.FileExtension -IsPublished $True -IconPath ‘C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe’ -IconIndex 0 }
First VM When Created 14: -command Set-RDSessionCollectionConfiguration -CollectionName @CollectionName@ -UserGroup ‘Domain\Members’ -DisconnectedSessionLimitMin 1 -ActiveSessionLimitMin 480 -IdleSessionLimitMin 480 -SecurityLayer 0 -ConnectionBroker @RDCB@.domain.NET

If you noticed, we added three additional variables here, so later on when we go to deploy this service template, I can choose the names of the @RDCB@, @RDWA@ with an actual host name, and @CollectionName@ with an actual collection name.

VMM-ScaleOut-RDS09

For all scripts, you need to browse to the Advanced option and then specify the Standard Output/Error and Restart policy as the following:

First VM When Created 1: Reboot Scripts Settings

We need to change the Standard Output/Error Failure policy to “Do not match”, because in case the reboot script failed, then VMM won’t stop and fail the entire RDS deployment.

VMM-ScaleOut-RDS13

Now for First VM When Created, Other VMs When Created and Other VMs When Deleted PowerShell Scripts Settings

We need to change the Standard Output Failure policy to “Do not match” and Standard Error Failure policy to “Match any string”, because if for any reason any of the PowerShell script failed during the deployment, then VMM will stop the deployment and the error will be logged into a text file inside the Virtual Machine, so you can troubleshoot and remedy the issue, and this makes your life a lot easier Winking smile.

You can set also the Action when matched to “warn and continue”, if for any reason any of the PowerShell script failed during the deployment, then VMM will not stop and fail the entire deployment, the error will be logged into a text file as well inside the VM.

VMM-ScaleOut-RDS11

We are done now with all prerequisites Smile.

In Part II we will cover how to create the service template design, and in Part III we will deploy the service, If you have any question or feedback, please feel free to leave a comment below:

Thanks for reading.

Stay tuned… Until then, enjoy your day!

Cheers,
/Charbel

About Charbel Nemnom 323 Articles

Charbel Nemnom is a Microsoft Cloud Consultant and Technical Evangelist, totally fan of the latest’s IT platform solutions, accomplished hands-on technical professional with over 15 years of broad IT Infrastructure experience serving on and guiding technical teams to optimize performance of mission-critical enterprise systems. Excellent communicator adept at identifying business needs and bridging the gap between functional groups and technology to foster targeted and innovative IT project development. Well respected by peers through demonstrating passion for technology and performance improvement. Extensive practical knowledge of complex systems builds, network design and virtualization.

Be the first to comment

Leave a Reply