Friday, 21 September 2018 08:05

Building the Perfect Horizon Cloud Image: A Step-by-Step Guide

Written by
Rate this item
(0 votes)

image

Automated reference image creation became common as IT professionals use tools like Microsoft Deployment Toolkit or System Center Configuration Manager. In most cases, creating a Windows reference image is fairly straightforward if you follow established best practices. However, there are still issues out there that may catch you off guard and you will suffer the consequences.

Last year I worked with a customer on a guided Horizon Cloud Proof of Concept. Horizon Cloud is a cloud service from VMware that allows you to quickly deploy virtual desktops and applications in the cloud (VMware data center, AWS, Azure) or on-premises. With increased compliance and security requirements, companies of all sizes are increasingly relying on desktop and apps virtualization to deliver their business-critical applications to their end-users.

Creating a Windows reference image is the foundation of adopting new cloud technology. The following guide describes my approach which I successfully used to help several customers to transition toward the cloud utopia. The resulting images for virtual desktop infrastructure deployments enable cloud based desktops creation that are directly consumable. The ultimate goal is to have a reference image creation methodology that’s easy to maintain, allows you to respond to changing business needs, includes necessary VMware software and customizations, will work for users in any region of the world, and will provide the desktop, applications and customizations they need in order to perform their jobs. If you have any questions about this guide, please leave a comment below.

Johan Arwidmark already outlined steps necessary to create a deployment share, configure rules and settings, and import all the applications and operating system files required to build Windows 7 / Windows 10 reference images with the Microsoft Deployment Toolkit. The approach described in Johan's blog posts is designed primarily for deployment to physical machines. However, the task sequences can be tweaked slightly to run perfectly on the VMware virtual platform.

Prerequisites

Let’s talk about prerequisites.

Attached to this blog (below) are source files you will need to complete this guide. In the following steps, I assume you have downloaded and extracted the zip archive to the C:\temp\VMwareHorizonSources folder..

Using Johan's blog posts, create a 'build & capture' MDT deployment share, configure rules and settings, and import all the applications and operating system files required to build a Windows reference image. After completing these steps outlined in great detail in his step-by-step guide, continue reading.

Download the VMware OS Optimization Tool (VMwareOSOptimizationTool_b1100_9320643.zip) archive and extract its contents to to C:\temp\VMware OS Optimization Tool 1.1.0. The VMware OS Optimization Tool helps optimize Windows systems for use with VMware Horizon View / VMware Horizon Cloud.

Download required VMware components (typically DaaS Agent, DaaS Health Agent, VMware Tools, View Agent) from the MyVMware Portal and place installation files in the corresponding Source folders. .

Note: Please be aware that the provided templates are version specific. You may need to adjust setup file names / installation parameters in the wsf installation scripts. Check VMware's documentation for further guidance.

Download Mikael Nystrom's CleanupBeforeSysprep.wsf script and place it in the C:\temp\Scripts folder.

Download my ApplyWin10Optimizations.ps1 script if you are building a Windows 10 image and place it in the C:\temp\Scripts folder.

Copy the contents of the C:\temp\Scripts folder to %SCRIPTROOT%.  

Walkthrough

Using the Deployment Workbench, right-click your deployment share and select Properties. Use the following settings for the x86/x64 boot images:

General Scratch Space 256
Features Enable following optional components PowerShell, .NET Framework, DISM Cmdlets, Storage Management Cmdlets
Drivers Selection profile All Drivers

Note: Even if you are not going to use both x86 and x64 boot images right away, I still recommend that you adjust all configuration settings for potential future use.

In order to utilize the vmxnet3 network adapter with MDT successfully, you need drivers for the boot images. First, extract the virtual hardware drivers from the VMware Tools bundle:

  1. Run the following command from the command prompt: setup.exe /A /P C:\temp\VMware (Note: If you are prompted to provide the location for the install/extraction, enter C:\temp\VMware).
  2. When the process is complete, click Finish.

Then, import extracted drivers into MDT for deployment.

Optional: create the logical folder VMware in the Deployment Workbench

Using the Deployment Workbench in the MDT deployment share, expand the Applications node and create the VMware node. Then, add VMware applications using following settings:

Application Name Command Line
VMware DaaS Agent 17.2.0 cscript.exe Install-DaaSAgent.wsf
VMware DaaS Health Agent 1.0.5 cscript.exe Install-HealthAgent.wsf
VMware Tools 10.2.0 cscript.exe Install-VMwareTools.wsf
VMware View Agent 7.3.2 cscript.exe Install-ViewAgent.wsf
VMware OS Optimization Tool 1.1.0 powershell.exe -ExecutionPolicy Bypass -File Apply-VMwareOSOptimizations.ps1

Note: The VMware OS Optimization Tool helps optimize Windows reference images for use with VMware Horizon Cloud. I included two templates (Windows 7 / 10) which include carefully curated set of adjustments to enable or disable Windows system services and features, per Microsoft best practices, to improve performance without detrimental effect on the end-user experience. The included PowerShell script will automatically select correct template for your environment (assuming you are creating a Windows 7 or 10 image)

Then, in the Task Sequences folder, right-click your reference image task sequence, and select Properties. Configure the task sequence with the following settings:

Preinstall Group:

After Gather local only action, add two Run Command Line action items with the following settings:

Name Command Line
Set-ExecutionPolicy Bypass powershell.exe -Command 'Set-ExecutionPolicy Bypass'
High Performance Power Scheme* PowerCfg.exe /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

Note: The reason for adding this is that this tweak reduces the time it takes to apply an OS WIM to disk by 20 – 50%. Check this blog post for additional details.

Postinstall group:

Before Next Phase action, add two Run Command Line action items with the following settings:

Name Command Line
Remove Built-In Apps powershell.exe -File %SCRIPTROOT%\RemoveApps\RemoveApps.ps1'
Remove Built-In Capabilities powershell.exe -File %SCRIPTROOT%\RemoveApps\RemoveCapabilitiesOffline.ps1

State Restore group:

After the Tattoo step within the State Restore phase, insert another Run Command Line action to set the power management scheme to High performance:

Name Command Line
High Performance Power Scheme PowerCfg.exe /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

Assuming you followed Johan's Windows (10) guide, you should have the Custom Tasks (Pre-Windows Update) group. Create the Install - VMware Horizon Tools group and add new Install Application actions with the following settings:

Name Install a Single Application:
Install - VMware Tools 10.2.0 VMware Tools 10.2.0

Repeat the previous step (add a new Install Application) to add the following applications:

  • Install - VMware DaaS Agent 17.2.0
  • Install - VMware DaaS Health Agent 1.0.5
  • Install - VMware View Agent 7.3.2
  • Apply - VMware OS Optimizations

Important: After the Install - VMware DaaS Health Agent 1.0.5 action, add a new Restart computer action.

Optional: Before the Install - VMware Horizon Tools group, add following Run PowerShell Script actions to apply additional configuration settings:

Name Command Line
Configure - Windows 10 OS %SCRIPTROOT%\ApplyWin10Optimizations.ps1
Configure - Enable RDP %SCRIPTROOT%\EnableRDP.ps1
Configure - IPv6 Components PowerShell script: %SCRIPTROOT%\DisableIPv6.ps1
Configure - Disable Windows Firewall %SCRIPTROOT%\DisableFirewall.ps1

Before the Imaging group, add Run Command Line action item with the following settings:

Name Command Line
Run - Cleanup Before Sysprep cscript.exe %SCRIPTROOT%\CleanupBeforeSysprep.wsf

The reason for running this script is to reduce the resulting OS disk footprint.

Note: Depending on the Horizon tennant version you are running, you may need to import basic DaaS Agent configuration during OSD to allow bootstrapping. This can be achieved by importing a reg file containing DesktopMgrAddresses. Below are two sample reg files for x86 / x64 systems:

x86:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware DaaS Agent]
"ConfiguredHostname"=dword:00000001
"vmid"="00000000-0000-0000-0000-000000000000"
"DesktopMgrAddresses"="172.16.1.2,172.16.1.3"
"AgentInstallPath"="C:\\Program Files\\VMware\\VMware DaaS Agent"

x64:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\VMware, Inc.\VMware DaaS Agent]
"ConfiguredHostname"=dword:00000001
"vmid"="00000000-0000-0000-0000-000000000000"
"DesktopMgrAddresses"="172.16.1.2,172.16.1.3"
"AgentInstallPath"="C:\\Program Files (x86)\\VMware\\VMware DaaS Agent"

Once you have created your task sequence, you are ready to create the VMware reference image. This will be performed by launching the task sequence from a VMware virtual machine (VMware Workstation or ESXi) which will then automatically perform the reference image creation process.

Note: If you are using VMware Workstation, you can automate this process further. Check out my Image Factory for VMware Workstation solution - it virtually eliminates the technical requirements for manually creating Windows images for VMware Environments.

Read 2730 times Last modified on Friday, 21 September 2018 10:22
  1. Comments (0)

  2. Add yours

Comments (0)

There are no comments posted here yet

Leave your comments

  1. Posting comment as a guest.
0 Characters
Attachments (0 / 3)
Share Your Location

Recent Posts