Using Automation to Create Optimized Windows Images for VMware Horizon VMs

Horizon 7
Horizon 8

Introduction

Overview

Although creating and updating Windows images manually is one strategy, it is error prone, cumbersome, and might lead to inconsistent results. Automation, while taking a bit of extra time to configure up front, repays this effort many times over in time-savings down the road and is therefore highly recommended.

In this guide, you learn how to automate the creation of images with Microsoft Deployment Toolkit (MDT), which can optionally be used with System Center Configuration Manager (SCCM). There are various ways of doing this, such as installing various roles across VMs, but for simplicity's sake, in this guide everything is installed and configured on a single VM. This way, you get a general understanding of the process. However, you should feel free to deploy the solution as you prefer.

For a list of the Windows operating systems we tested, see the section called Tested Operating Systems, in the guide Manually Creating Optimized Windows Images for VMware Horizon VMs.

Important: This guide describes how to automate the creation of VMware vSphere® VMs that have an optimized Windows 10 or Windows Server guest operating system, with various VMware agents installed and, optionally, other applications.

Purpose of This Guide

Using Automation to Create Optimized Windows Images for VMware Horizon VMs provides step-by-step procedures for creating optimized images. These procedures include creating a vSphere VM, installing and configuring a Windows operating system, optimizing the OS, and installing the various VMware agents required for deployment in a VMware Horizon® environment.

Important: The procedures in this guide are sequential and build on one another, so make sure to complete each procedure in each chapter before moving on to the next.

Infrastructure Prerequisites

Before you can perform the procedures in this guide, you must have certain infrastructure components installed and configured.

Your VMware vSphere infrastructure can reside either on-premises or on one or more cloud platforms. Verify that you have the following components installed and configured:

  • VMware vSphere and vCenter Server. We used vSphere 7.0 U2b and Horizon 2103 in our testing. For information and installation instructions, see the VMware vSphere documentation.
  • VMware ESXi™ host or hosts configured in the vCenter Server instance.
  • An infrastructure that includes Active Directory, DNS, and DHCP.
  • If you intend to use VMware App Volumes™, you must have the host name or IP address of the server on which App Volumes Manager is installed or the load balancer fronting the server on which App Volumes Manager is installed. You will enter this information when you install the App Volumes Agent on the primary VM image.

If you plan to create Horizon desktop pools or RDSH server farms, ideally at this point you would also have Horizon Connection Server installed and configured. For installation instructions, see the Quick-Start Tutorial for VMware Horizon 8.

The automation strategies described in this guide do not apply to VMware Horizon® Cloud Service™ on Microsoft Azure, which uses Azure VMs that you import from the Azure Marketplace. The Horizon Cloud Service is a VMware-managed virtual desktop and application solution that provides desktops as a service using a Microsoft Azure public cloud infrastructure. For more information, see the VMware Horizon Cloud Service Documentation.

Installation

Install the Windows Assessment and Deployment Kit (ADK)

We start with an Active Directory joined Windows Server (we used Server 2019) VM, registered in DNS. If you do not create many VMs at the same time, 2 vCPUs and 4 GB of RAM are more than enough, but size according to your needs. We are using a 200-GB secondary disk because we want to build all images that we support. For only a single image or a couple of images, however, you do not need that much storage.

As was mentioned in the introduction to this guide, we are going to combine Windows Deployment Services, the MDT deployment share, the SQL server, and the MDT console on a single machine, but you can adjust this to your wishes.

The Windows Assessment and Deployment Kit (Windows ADK) has tools for customizing Windows images for large-scale deployments. MDT uses the ADK to modify the Windows Preinstallation Environment bootable image.

1. Download Windows Assessment and Deployment Kit (ADK)

Download and run ADKSETUP.

2. Specify the Installation Path

Click Next.

3. Complete the Privacy Page

  1. Select No.
  2. Click Next.

4. Accept the License Agreement

Click Accept.

5. Select Features and Begin Installation

Click Install.

6. Exit the Wizard

Click Close.

Install the Windows Preinstallation Environment (PE) ADK Add-on

Windows PE is a small operating system used to install, deploy, and repair Windows. It is used by MDT to create a bootable image to set up Windows.

1. Download the Windows Preinstallation Environment (PE) ADK Add-on

Download and run ADKWINPESETUP.

2. Specify the Installation Path

Click Next.

3. Complete the Privacy Page

Click Next.

4. Accept the License Agreement

Click Accept.

5. Select Features and Begin Installation

Click Install.

6. Exit the Wizard

Click Close.

Install Microsoft SQL Server

This procedure describes installing SQL Server Express Edition, but you can also use an existing Microsoft SQL Server, or install a Standard or Enterprise version. A SQL database is used to select which machine should get which task sequences and applications.

1. Download and Start the Microsoft SQL Server Installer

Download the SQL Server installer; for this example download and run SQL Express.

2. Select the Basic Installation Type

Click Basic.

3. Accept the License Agreement

Click Accept.

4. Specify the Installation Path and Begin Installation

Click Install.

5. Exit the Wizard

Click Close.

6. Confirm Closing the Wizard

Click Yes.

Install the Microsoft Deployment Toolkit (MDT)

MDT helps automate the deployment of Windows operating systems and applications. Use MDT to configure the unattended Setup files for Windows and package the necessary files into a consolidated image file that you then deploy to reference and target computers. For more information, see Using the Microsoft Deployment Toolkit.

1. Download the Microsoft Deployment Toolkit (MDT)

Download and run MicrosoftDeploymentToolkit_x64.

2. Click Next on the Welcome Page

Click Next.

3. Accept the License Agreement

  1. Select I accept.
  2. Click Next.

4. Select the Custom Setup Type

Click Next.

5. Complete the CEIP Page

  1. Select I don't want to join.
  2. Click Next.

6. Begin Installation

Click Install.

7. Exit the Wizard

Click Finish.

Install Windows Deployment Services

Windows Deployment Service (WDS) is a server role that gives administrators the ability to deploy Windows operating systems over the network. Microsoft WDS is used to load the MDT-created Windows PE boot image to perform the installation of Windows.

1. Go to Server Manager to Add Roles and Features

Click Add roles and features.

2. Click Next on the Before You Begin Page

Click Next.

3. Select Role-Based or Feature-Based Installation

Click Next.

4. Select a Destination Server

Click Next.

5. Select Windows Deployment Services

Select Windows Deployment Services.

6. Add Features

Click Add Features.

7. Select the WDS Server Role

Click Next.

8. Click Next on the Select Features Page

Click Next.

9. Click Next on the WDS Page

Click Next.

10. Select the WDS Role Services

Click Next.

11. Begin Installation

Click Install.

12. Exit the Wizard

Click Close and exit Server Manager.

Configuration

Enable SQL Server Protocols and Browser

In this section, you enable the Named Pipes protocol and the TCP/IP protocol and configure the TCP ports for the SQL Server database that you will create in a later section of this guide. You also enable the SQL Server Browser.

1. Start SQL Server Configuration Manager

  1. Click the Start button.
  2. Select Microsoft SQL Server 2019.
  3. Select SQL Server Configuration Manager.

2. Select the Named Pipes Protocol

  1. Expand SQL Server Network Configuration.
  2. Select Protocols for SQLEXPRESS.
  3. Double-click Named Pipes.

3. Enable Named Pipes

  1. Select Yes for Enabled.
  2. Click OK.

4. Select TCP/IP Properties

  1. Right-click TCP/IP.
  2. Select Properties.

5. Enable the TCP/IP Protocol

Select Yes for Enabled

6. Configure the TCP Ports

  1. Click the IP Addresses tab.
  2. At the bottom of the page, under IPAll, make TCP Dynamic Ports blank.
  3. Enter 1433 as TCP Port.
  4. Click OK.

7. Restart SQL Server Services

  1. Click SQL Server Services.
  2. Right-click SQL Server.
  3. Select Restart.

8. Select the SQL Server Browser Properties

  1. Right-click SQL Server Browser.
  2. Select Properties.

9. Set the Start Mode to Automatic

  1. Select Automatic for Start Mode.
  2. Click OK.

10. Start the SQL Server Browser

  1. Right-click SQL Server Browser.
  2. Select Start.

Allow SQL in Firewall

Use this procedure to create firewall rules that allow inbound connections on TCP port 1433 and UDP port 1434 from your SQL Server.

1. Open Your Windows Firewall Application to Create a New Inbound Rule

Go to Windows Defender Firewall with Advanced Security (or any other firewall) and click New Rule.

2. Select the Port Rule Type

  1. Select Port.
  2. Click Next.

3. Specify TCP Port 1433

  1. Select 1443 for Specific local ports.
  2. Click Next.

4. Allow the Connection

Click Next.

5. Apply the Rule to All Profiles

Click Next.

6. Name the Rule SQL Inbound TCP

  1. Type SQL Inbound TCP.
  2. Click Finish.

7. Create a Similar Rule for UDP Port 1434

Repeat the steps in this procedure for the UDP protocol and port 1434.

Create the Deployment Share

Use this procedure to create a deployment share that will store the boot images, applications, and drivers used to automatically create Windows images.

1. Open the Deployment Workbench

  1. Click the Start button.
  2. Expand the Microsoft Deployment Toolkit folder.
  3. Select Deployment Workbench.

2. Start the New Deployment Share Wizard

  1. Right-click Deployment Shares.
  2. Select New Deployment Share.

3. Specify the Path

  1. Point to the second drive.
  2. Click Next.

4. Specify the Share Name

  1. Choose the desired Share name.
  2. Click Next.

5. Supply a Description

  1. Choose the desired Deployment share description.
  2. Click Next.

6. Deselect Wizard Pane Options

  1. Deselect all wizard panes.
  2. Click Next.

7. Begin Share Creation

Click Next.

8. Exit the Wizard

After the process completes, click Finish.

Add Out-of-Box Drivers

In this procedure, you import various display, network, and mouse drivers onto your new deployment share. MDT injects these into your bootable image and adds them to the target during OS installation.

1. Copy Drivers to a New Folder

From c:\Windows\System32\DriverStore\FileRepository, copy the folders starting with the following names to a new folder:

display.inf
pvscsi.inf
vmmouse.inf
vmusbmouse.inf
vmxnet3.inf
vm3d.inf

2. Start the Import Driver Wizard from Your Deployment Share

  1. In the Deployment Workbench, navigate to the deployment share you created in the previous exercise and right-click Out-of-Box Drivers.
  2. Select Import Drivers.

3. Specify the Path to the Drivers

  1. Provide the location of the folder you created in the first step of this procedure.
  2. Click Next.

4. Begin Importing Drivers

Click Next.

5. Exit the Wizard

Click Finish. The warnings can be ignored as long as they do not say that platform amd64 is not supported.

Set Deployment Share Properties

In this procedure, you specify architecture platforms you plan to use, add rules to skip various prompts during image creation, supply credentials, and include the drivers you imported during a previous exercise.

1. Edit Deployment Share Properties for the MDT Deployment Share

  1. In the Deployment Workbench, click the name of your new deployment share.
  2. Click Properties.

2. Complete the General Tab

If you are not using the x86 platform, deselect it.

3. Complete the Rules Tab

1. Add the following rules with your desired values before you click Edit Bootstrap.ini.

SkipDomainMembership=YES
SkipUserData=YES
SkipFinalSummary=YES
SkipLocaleSelection=YES
SkipBDDWelcome=YES
SkipComputerName=YES
SkipDeploymentType=YES
SkipRoles=YES
SkipSummary=YES
JoinWorkgroup=WORKGROUP
SkipTimeZone=Yes
TimeZoneName=[your timezone]
_SMSTSOrgName=[your company]

You can get your current timezone by running the following command on a Windows system:

tzutil /g

Or get the full list by running:

tzutil /l

2. Click Edit Bootstrap.ini.

4. Add Rules to Skip the Welcome Screen and Supply Domain Credentials

Add the following rules before you close and save the file.

SkipBDDWelcome=YES
KeyboardLocale=[your locale]
UserID=[your MDT user]
UserPassword=[your password]
UserDomain=[your domain]

5. Complete the Windows PE Tab

  1. Click on Windows PE.
  2. Select x64.
  3. Click on Drivers and Patches.
  4. Select Include all drivers from the selection profile.
  5. Click OK.

6. Open the Update Deployment Share Wizard

  1. Right-click the deployment share.
  2. Select Update Deployment Share.

7. Select the Optimize Option

Click Next.

8. Begin the Update Process

Click Next.

9. Exit the Wizard

After the process completes successfully, click Finish.

Create the Database Table and Configure Database Rules

In this procedure, you create a database on the SQL Server you created and configured in a previous exercise, and you configure the database for basic functionality.

1. Start the New DB Wizard

  1. In the Deployment Workbench, expand Deployment Shares.
  2. Expand the new deployment share you created in a previous exercise.
  3. Expand Advanced Configuration.
  4. Right-click Database.
  5. Select New Database.

2. Provide the SQL Server and Instance Names

  1. Provide the SQL Server name.
  2. Provide the Instance name (when not using the default).
  3. Click Next.

3. Name the Database

  1. Provide a table name.
  2. Click Next.

4. Select the Deployment Share

  1. Use the deployment share.
  2. Click Next.

5. Begin Database Creation

Click Next.

6. Exit the New DB Wizard

Click Finish. You are returned to the main Deployment Workbench window, with Database selected in the left page, information about the new database in the middle pane, and a list of database actions in the right pane.

7. Start the Configure DB Wizard

Click Configure Database Rules.

Note: For basic functionality use the settings shown in the steps that follow; for advanced selections, use your own.

8. Select Computer Options

  1. Select only Query for computer-specific settings and Query for applications to be installed on this computer.
  2. Click Next.

9. Deselect Location Options

  1. Click Deselect All.
  2. Click Next.

10. Deselect Make/Model Options

  1. Click Deselect All.
  2. Click Next.

11. Deselect Role Options

  1. Click Deselect All.
  2. Click Next.

12. Begin Database Configuration

Click  Next.

13. Exit the DB Configuration Wizard

Click Finish.

Configure Windows Deployment Services and Add Them to DHCP

In this procedure, you configure the Windows Deployment Services PXE server to use the MDT-generated image, and you specify which types of computers to respond to. You also configure boot properties and Trivial File Transfer Protocol (TFTP) properties. After this configuration is complete, you set DHCP options for PXE boot.

1. Open Windows Deployment Services

  1. Click the Start button.
  2. Under Administrative Tools, select Windows Deployment Services.

2. Start the Windows Deployment Services Configuration Wizard

  1. Right-click the local server.
  2. Select Configure Server.

3. Click Next on the Before You Begin Page

Click Next.

4. Select the Integrated Installation Option

Click Next.

5. Specify a Path to the Remote Installation Folder

  1. Select a folder on the secondary drive.
  2. Click Next.

6. Configure Which Computers the PXE Server Will Respond To

  1. Select Respond to all client computers (or take your own preference).
  2. Click Next.

7. Complete the Configuration Wizard

  1. Deselect Add images to the server now.
  2. Click Finish and close the Deployment Workbench console.

8. Start the Add Image Wizard

  1. In the Windows Deployment Services window, under the local server, right-click Boot Images.
  2. Select Add Boot Image.

9. Browse to the Image File

Click Browse.

10. Select the Image File

  1. Navigate to the Boot folder under the DeploymentShare.
  2. Select LiteTouchPE_x64.wim.
  3. Select the image file and click Open.

11. Click Next on the Image File Page

Click Next.

12. Click Next on the Image Metadata Page

Click Next.

13. Click Next on the Summary Page

Click Next.

14. Open the Properties Editor for the Local Server

  1. In the Windows Deployment Services window, right-click the local server.
  2. Select Properties.

15. Configure Boot Properties

  1. Click the Boot tab.
  2. Select Always continue the PXE boot for both Known clients and Unknown clients.

16. Configure TFTP Properties

  1. Click the TFTP tab.
  2. Enter 1456 as Maximum Block Size.
  3. Deselect Enable Variable Window Extension.
  4. Click OK.

17. Restart All Tasks

  1. Right-click the local server.
  2. Select All Tasks.
  3. Select Restart and close the Windows Deployments Services console.

18. Add Deployment Services to DHCP

In your DHCP server, set option 66 to the FQDN of your Windows Deployment Services Server and set option 67 to boot\x64\wdsmgfw.efi.

Add the VMware OS Optimization Tool MDT Plug-in

Adding the OSOT MDT Plug-in is a simple process of downloading a ZIP file and placing certain files and folders in a couple of locations.

1. Download the OS Optimization Tool MDT Plug-in

  1. Select I have read and agree to the Technical Preview License on the OSOT Fling website.
  2. Select the VMwareHorizonOSOptimizationToolMDTPlugin zip file.
  3. Click DOWNLOAD.

2. Copy Files and Folders to the Correct Locations

  1. Put the Templates and VMware folders in the root of the deployment share.
  2. Copy the contents of the Bin folder to C:\Program Files\Microsoft Deployment Toolkit\Bin.

Now that all configuration tasks are complete, you can deploy the image, as described in the next chapter.

Deployment

Add Applications in the Microsoft Deployment Tool

In this procedure, you download application source files and then use the New Application Wizard in MDT Deployment Workbench to import those application source files to a directory on the deployment share.

As an example, we use Microsoft Office 2019, but the same principle applies for any application that goes into the golden image.

1. Download the Microsoft Office Deployment Tool

Download and run the Microsoft Office Deployment Tool.

2. Accept the License Agreement

  1. Accept the license.
  2. Click Continue.

3. Specify a Folder for Storing the Office Files

  1. Select a folder.
  2. Click Make New Folder.
  3. Enter a name.
  4. Click OK.

4. Click OK in the Confirmation Box

Click OK.

5. (Optional) Create a Configuration File to Be Used by the Office Deployment Tool

Optionally you can create a configuration XML file with the Office Customization Tool. This tool gives you fine-grained control over the Office installation.

6. Start the New Application Wizard in Deployment Workbench

  1. In the Deployment Workbench, under the correct deployment share, right-click Applications.
  2. Select New Application.

7. Select Application with Source Files for Application Type

Click Next. This selection imports the application files directory into a directory located in the deployment share.

8. Specify the Application Name, Publisher, Version, and Language

  1. Provide application details.
  2. Click Next.

9. Browse to the Folder with the Extracted Office Files

  1. Click Browse.
  2. Browse to the folder you created at the beginning of this procedure.
  3. Click OK.
  4. Click Next.

10. Name the Destination Folder

  1. Provide a name for the directory that will be created on the deployment share to store this imported application.
  2. Click Next.

11. Specify the Command-Line Command for Running the Installer

  1. Provide a command line for attended install.
  2. Click Next.

12. Begin the Import Process

Click Next.

13. Exit the Wizard

Click Finish.

Add Operating Systems in MDT

In this procedure, you use the Import Operating System Wizard in MDT Deployment Workbench and import Windows OS source files from an ISO file to a directory on the deployment share.

Prerequisite

Before you complete this procedure, you need to download an ISO file that contains a supported version of the Windows operating system. For a list of the operating systems we tested, see Tested Operating Systems in the document Manually Creating Optimized Images for VMware Horizon VMs. For a complete list of supported Windows 10 operating systems, see the VMware knowledge-base article Supported versions of Windows 10 on Horizon Agent Including All VDI Clones (Full Clones, Instant Clones, and Linked Clones on Horizon 7) (2149393).

Important: Use an OS version that has a Microsoft Windows volume license key using the Key Management Service (KMS). KMS treats each activated clone as a computer with a newly issued license. In a production environment, you must activate Windows. In an evaluation environment, you can create the VM and log in without activating Windows.

1. Start the Import Operating System Wizard

  1. Double-click to mount the ISO file you downloaded  from Microsoft, open the Deployment Workbench, and under the correct deployment share, right-click Operating Systems.
  2. Select Import Operating System.

2. For OS Type, Select Full Set of Source Files

Click Next.

3. Browse to the Source Files on the ISO

  1. Click Browse.
  2. Browse to the mounted ISO.
  3. Click Next.

4. Name the Destination Folder

  1. Provide a name for the directory that will be created on the deployment share to store the OS files.
  2. Click Next.

5. Begin the Import Process

Click Next.

6. Exit the Wizard

Click Finish. The newly imported OS editions are listed in the Deployment Workbench, under Operating Systems for the specified deployment share.

7. Delete OS Editions You Do Not Plan to Use

  1. In the Deployment Workbench, use CTRL-click to select all editions that will not be used, and then right-click.
  2. Select Delete.

Add VMware Agents and Tools

In this procedure, you download various VMware agents and tools, as well as a couple of third-party tools, and copy these installers to the correct sub-folders of the VMware folder on the deployment share.

Prerequisites

To perform this exercise, you need the following:

  • VMware folder – You need to have completed the previous exercise Add the VMware OS Optimization Tool MDT Plug-in. Part of that exercise involves downloading the OS Optimization Tool MDT Plug-in, extracting its files and folders, and copying the VMware folder to the deployment share.
  • App Volumes installer – VMware App Volumes™ is included with Horizon Enterprise Edition, available from the Download VMware Horizon page. The App Volumes installer is distributed as an ISO file. Extract the ISO contents to a folder so that you can copy the App Volumes Agent.msi file.
  • Dynamic Environment Manager installer – The VMware Dynamic Environment Manager™ installer is available from the VMware Downloads page. It is also included with Horizon Enterprise Edition. The MSI installer file is included in a ZIP file.
  • Horizon Agent installer – This executable (.exe) file is available from the Download VMware Horizon page.

1. Navigate to the VMware Folder on the Deployment Share

In the File Explorer, go to the VMware folder on the deployment share.

2. Copy the App Volumes Agent Installer into a Sub-Folder

Copy the App Volumes Agent.msi file into the AppVolumesAgent folder if you use App Volumes.

3. Copy the Dynamic Environment Manager Installer into a Sub-Folder

Copy the VMware Dynamic Environment*.msi file into the DEM folder if you use Dynamic Environment Manager.

4. Copy the Horizon Agent Installer into a Sub-Folder

Copy the VMware-Horizon-Agent*.exe file into the HorizonAgent folder.

5. Download and Copy Various Tools Files into the OSOT Sub-Folder

  1. Download the VMwareOSOptimizationTool files and copy them into the OSOT folder.
  2. Download and extract the third-party tools LGPO.exe (Local Group Policy Object Utility) and sdelete64.exe (Secure Delete) and copy the files into the OSOT folder.

6. Unblock the LGPO.exe and sdelete64.exe Executables

Right-click each file (sdelete64.exe and lgpo.exe), select Properties, and in the Properties dialog box, select Unblock and click OK.

7. Download and Copy the VMware Tools Installer into a Sub-Folder

Download the VMware-tools-*.exe file and copy it into the VMwareTools folder.

Create and Edit MDT Task Sequences

A task sequence is a set of instructions that tell the deployment tool how to create or deploy an image. In this procedure, you will use a task sequence template from VMware to create a task sequence for installing and configuring the Windows OS and VMware agents and tools, and also for running the OS Optimization Tool.

You will then also the catalog for the Windows system image, which creates an answer file for running an unattended installation.

1. Create a Task Sequence Based on a VMware Template

You select a VMware OSOT task sequence and complete the wizard to configure some basic OS installation settings.

1.1. Start the New Task Sequence Wizard

  1. In the Deployment Workbench, under the correct deployment share, right-click Task Sequence.
  2. Select New Task Sequence.

1.2. Specify an ID and Name for the Task Sequence

  1. Provide a Task sequence ID.
  2. Provide a task sequence name.
  3. Click Next.

1.3. Select a VMware OSOT Task Sequence

  1. Select VMware OSOT Task Sequence.
  2. Click Next.

1.4. Select the Operating System

  1. Select an operating system version and edition.
  2. Click Next.

1.5. Do Not Specify a Product Key

Click Next.

1.6. Specify a Name and Organization

  1. Complete the Name and Organization text boxes.
  2. Click Next.

1.7. Do Not Specify an Administrator Password

  1. Select Do not specify an Administrator password.
  2. Click Next.

1.8. Begin Creating the Task Sequence

Click Next.

1.9. Exit the Wizard

Click Finish.

2. Generate a Catalog for the OS Image and Edit the Unattend.xml File

You next generate a catalog for the operating system image, and use Windows System Image Manager (SIM) to edit the answer file for an unattended installation.

2.1. Open the Task Sequence Properties Dialog Box

In the Deployment Workbench, with Task Sequences selected under the deployment share, double-click the icon in front of the task sequence you just created.

2.2. Click Edit Unattend.xml

  1. Click the OS Info tab.
  2. Click Edit Unattend.xml.

2.3. Wait for the OS Image Catalog to Be Generated

The first time you do this for each operating system version/edition, the process of generating the catalog takes a while.

2.4. Drag Reseal to 7 oobeSystem

  1. Expand amd64_Microsoft-Windows-Deployment.
  2. Drag Reseal to 7 oobeSystem.

2.5. Change to Audit Mode

  1. With Reseal selected in the middle pane, in the right pane, change Mode to Audit.
  2. Click on the verify icon.

2.6. Delete the Display Section and, for Servers, the SystemRestore Section

  1. Double-click the first message (ColorDepth).
  2. Right-click Display under amd64_Microsoft-Windows-Shell-Setup_neutral.
  3. Select Delete.

Note: For a Windows Server Image there is a second section (SystemRestore) that needs deletion.

2.7. Confirm Deletion of the Item

Click Yes.

2.8. For NetworkLocation, Revert Change

  1. Double click the NetworkLocation is deprecated warning.
  2. Right-click NetworkLocation.
  3. Select Revert Change.

2.9. Save Your Changes and Close the Windows SIM

  1. Click the Save icon on the toolbar. This will validate again and should show no warnings or errors.
  2. Close Windows System Image Manager. You are returned to the task sequence Properties dialog box.

3. Select the Option to Install the .Net 3.5 Feature

  1. Click the Task Sequence tab.
  2. Under State Restore, click Install Roles and Features.
  3. Select your operating system.

3.1. Specify .NET Framework 3.5

For a Windows Server Operating System:

  1. Collapse the Roles list.
  2. Under Feature, select .NET Framework 3.5.

3.2. Deselect the Option to Disable This Step

  1. Click the Options tab.
  2. Deselect Disable this step.

4. Edit Tasks for VMware Agents and OS Optimization

The next tasks include installing VMware Tools, Horizon Agent and other agents, and running the OS Optimization Tool.

4.1. Select VMware Tools Options

  1. Click VMware Tools.
  2. Click the Properties tab.

Note: It is important that this page be opened once so that the MDT plug-in can detect the version.

Here you can optionally modify the VMware Tools options.

4.2. Select OSOT Optimization Options

Under Optimize you can optionally modify the VMware OS Optimization Tools optimizations.

4.3. Select OSOT Sysprep Options

Under Generalize you can optionally modify the VMware OS Optimization Tools Sysprep options.

4.4. For RDS Hosts, Enable the Remote Desktop Services Step

When running a Windows Server operating system as an RDS host:

  1. Click Remote Desktop Services.
  2. Click the Options tab.
  3. Deselect Disable this step.

Important: If you are creating a Windows Server image to create an RDSH farm, also enable Restart computer below Remote Desktop Services. Currently RDSH builds cannot be fully automated with the MDT plug-in for the OS Optimization Tool. When the task sequence reaches the Restart omputer step, you will have to manually log in as Administrator to allow the sequence to continue.

4.5. Select Horizon Agent Options

Click Horizon Agent.

Note: It is important that this page be opened once so that the MDT plug-in can detect the version.

Here you can optionally modify Horizon Agents options.

4.6. Select Dynamic Environment Manager Options

Click Dynamic Environment Manager.

Note: It is important that this page be opened once so that the MDT plug-in can detect the version.

Here you can optionally modify Dynamic Environment Manager options.

4.7. Select App Volumes Options

Under App Volumes Agent you can optionally modify the App Volumes Manager information.

4.8. Deselect Disable This Step on the Options Tab

  1. Click on Options.
  2. When using App Volumes, deselect Disable this step.

4.9. Select OSOT Finalize Options

Under Finalize you can optionally modify the VMware OS Optimization Tools Cleanup actions.

Create and Deploy VMs

To assist in creating and working with virtual machines, two PowerShell scripts have been provided. These require PowerCLI.

Use the CreateResetVM.ps1 script to:

  • Create new VMs that use the given specification.
  • Reset existing VMs. Any snapshots are deleted, the existing hard disk is deleted, and a new hard disk is added to the VM. 
  • Optionally add new VMs to the MDT database, specifying a task sequence for MDT to use.   
  • Optionally power on the VM after it is created or reset. 
  • Open a vSphere remote console to the VM. 
  • Provide a GUI that allows selection of VMs from a list in a comma-separated file that contains the VM names and specifications.

Use the ExportVMtoOVA.ps1 script to:

  •  Assist with exporting virtual machines to OVA files.
  • Provide a GUI that allows selection of VMs from a list in a comma-separated file that contains the VM names.

1. Install VMware PowerCLI

  1. Start a PowerShell Console and run Install-Module VMware.PowerCLI.
  2. Type Y and press enter.
  3. Type A and press enter.

2. Install the VMware Remote Console

Download, extract, and run the VMware Remote Console Installer.

 

2.1. Click Next on the Welcome Page

Click Next.

2.2. Accept the License Agreement

  1. Select I accept the terms.
  2. Click Next.

2.3. Click Next on the Custom Setup Page

Click Next.

2.4. Click Next on the User Experience Settings Page

Click Next.

2.5. Begin Installing the VMware Remote Console

Click Install.

2.6. Exit the Wizard

Click Finish.

3. Use the PowerShell Scripts from VMware

Download the Create or Reset VMs script and extract it. You will use this script with Microsoft Deployment Toolkit (MDT) to automate the creation of VMs that then PXE-boot and follow the MDT task sequence you created in a previous exercise. MDT can then use the OS Optimization Tool and the MDT plug-in to automate the installation of the agents and the optimization of Windows.

3.1. Edit CreateResetVM.ps1

  1. Change $vCenterServer to the FQDN of the vCenter Server.
  2. Change $ClusterName to the name of the cluster.
  3. Change $ResourcePoolName to the name of the resource pool.
  4. Change $SQLServer to the FQDN of the SQL Server, in our case, the MDT Server.
  5. Change $SQLDatabase to the name of the database.
  6. Change$SQLIntegratedAuth to $True when using the current user credentials.

3.2. Edit VMList.csv to Amend the List of VMs as Necessary

This is a comma-delimited file with one VM per row. Fields are:

  • Name is the name of the VM.
  • TaskSeq is the name of the MDT task sequence.
  • Datastore is the name of the vSphere datastore.
  • Network is the name of the vSphere network.
  • Folder is the name of the vSphere VM and template folder.
  • Disk is the amount of diskspace of the VM, in GB.
  • Mem is the amount of memory of the VM, in GB.
  • vCPU is the number of virtual CPUs in the VM.
  • Displays is the number of monitors the VM will support.
  • VideoMem is the amount of video memory of the VM, in GB.
  • HWVersion is the Virtual Machine hardware version.
  • GuestId is Windows9_64Guest for Windows 10, Windows9Server64Guest for Windows Server 2016, and Windows2019srv_64Guest for Windows Server 2019.

Note: HWVersion 15 and earlier do not have Windows2019srv_64Guest. Use windows9Server64Guest (Windows Server 2016) for Windows Server 2019 with HWVersion 15 and earlier.

3.3. Run the CreateResetVM.ps1 Script

Open a PowerShell prompt to run this script with or without parameters, as shown in the accompanying readme file.

3.4. Complete the Create or Reset Virtual Machines Dialog Box

  1. Select the VMs that you want to either create or reset. The list of VMs is read from the vmlist.csv file. Multiple VMs can be selected using the Shift or Control keys.
  2. Select Pause to add apps to MDT if the VMs are being created for the first time and applications or roles need to be set before deployment. You can add these in the MDT Console (which does have to be restarted if already open).
  3. Select Add to MDT database to add the VMs to the MDT database when a machine with the MAC address of the VM does not exist.
  4. Select Power on to start the VM after creation.
  5. Select Remote console to launch a VMware Remote Console window to show progress.
  6. Click OK.

If you do not specify credentials for the vCenter Server in the parameters when running the script, you will be prompted to authenticate.

3.5. Provide Credentials for vCenter Server If Prompted

  1. Provide the vSphere User name.
  2. Provide the Password.
  3. Click OK.

Note: If Add to MDT database was selected you might also be prompted to authenticate to the SQL Server instance. This depends on whether integrated authentication is being used or if you specified the SQL user name and password as parameters.

3.6. (Optional) Export to OVA

If you want to export to OVA you can use the Export VMs to OVA script.

Make Updates to the Image

Because you are using the Microsoft Deployment Toolkit (MDT), updates are a simple matter of copying (importing) the new thing into the correct location on the deployment share and then running the PowerShell scripts again to create a new, updated image. You do not need to repeat most of the procedures in this guide. For example:

  • To update an application, download the new version of the source files and then use the procedure Add Applications in the Microsoft Deployment Tool to add the new files and overwrite the old files on the deployment share.
  • To update the OS (feature update), download the new version and use the procedure Add Operating Systems in MDT to add a new OS version.
  • To update one of the agents, download the new version of the installer and use the procedure Add VMware Agents and Tools to add the new file and remove the old file on the deployment share. After you add the new file, open the agent section in the task sequence so that the installation command for the agent in the task sequence gets updated.

After you add the new version to the deployment share, run the CreateResetVM.ps1 script again, as described in the procedure Use the PowerShell Scripts from VMware. To simply install a Windows security patch or some other type of Windows Update patch, just run the CreateResetVM.ps1 script again. As part of the task sequence, Windows Update is run.

Conclusion

In Conclusion

This guide shows you how to use the Microsoft Deployment Toolkit, along with the VMware OS Optimization Tool MDT Plug-in and some VMware-provided PowerShell scripts, to automate all the manual tasks previously described in Manually Creating Optimized Windows Images for VMware Horizon VMs.

With the image optimization strategies in this guide, you can achieve a significant reduction in the amount disk space, CPU, and memory used by virtual desktop and RDSH server VMs and their vSphere hosts. The result is a corresponding savings in initial deployment time, user logon times, and IOPS. Installation of VMware agents is also included in the task sequences that are part of automation.

The procedures in this guide help you create an optimized Windows image that you can use in a VMware Horizon implementation or in other types of deployments. End users will have a great experience, whether they access their personalized virtual desktops or remote applications from company laptops, their home PCs, thin-client devices, Macs, tablets, or smartphones.

Additional Resources

Changelog

The following updates were made to this guide.

Date Description of Changes
2021-07-01

Initial publication.

Authors and Contributors

Hilko Lantinga is a Staff End-User Computing (EUC) Architect in VMware Technical Marketing, with a focus on 3D, Horizon Windows Desktops and RDSH, Linux, and Applications. Previously, he was a Senior Consultant in VMware Professional Services, leading large-scale EUC deployments in EMEA and has over 20 years of experience in end-user computing.

Caroline Arakelian is a Senior Technical Marketing Manager, EUC Technical Marketing, VMware.

The following people contributed to the review of this paper:

  • Darren Hirons, Lead Solution Engineer in Digital Workspace UK, VMware

To comment on this paper, contact VMware EUC Technical Marketing at euc_tech_content_feedback@vmware.com.

Filter Tags

Horizon App Volumes Dynamic Environment Manager Horizon Horizon Apps Document Operational Tutorial Intermediate Deploy Manage Modern Management Windows Delivery