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:
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:
- 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).
- 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:
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:
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:
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:
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:
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:
Before the Imaging group, add Run Command Line action item with the following settings:
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.