Product Documentation

Prepare your OS image for layering

May 30, 2018

This topic explains how to prepare a clean OS image for layering, and then import the image into a new OS layer. Once created, you can use the OS layer to build as many App layers, Platform layers, and image templates as you need.

Hypervisor Operating system
XenServer, Hyper-V, vSphere Windows Server 2016, Windows Server 2012, Windows Server 2008 R2,Windows 10*, Windows 7
Azure Windows Server 2016, Windows Server 2012, Windows 10
Nutanix AHV Windows Server 2016, Windows Server 2012, Windows Server 2008 R2, Windows 10*, Windows 7

*Support for Windows 10 versions:

  • Versions 1709, 1703, and 1607 are supported.
  • Version 1607 start times can be improved by removing Store Apps.

XenServer, Hyper-V, vSphere

To prepare an operating system for layering, you:

  • Step 1: Install the OS on a virtual machine
  • Step 2: Copy the App Layering OS Machine Tools onto the image
  • Step 3: If using Key Management Service (KMS), configure license activation scripts
  • Step 4: Make sure .Net Framework 3.5.1 is installed
  • Step 5: If using PVS, remove any ghost NICs
  • Step 6: Install the App Layering services

Step 1: Install the OS on a virtual machine

It is crucial to start with an OS freshly installed from ISO, preferably from your hypervisor.

Windows Server 2016, Windows Server 2012 R2, Windows Server 2008 R2 (Session Host)

  1. Log into your hypervisor client.
  2. Create a virtual machine for your operating system image. Ensure that you choose the default cluster allocation size of 4 K.
  3. Configure the virtual machine hardware settings, for example, the video memory and network adapter. You can have one, and only one, network device. VMware: For network device you must select the VMXNET 3 network adapter. When attempting to boot the image in environments such as Citrix PVS, Citrix MCS, or VMware Horizon View, the default E1000 adapter (or even a ghost NIC leftover from an E1000 adapter) can cause customization timeout errors on the virtual machines.
  4. Configure a virtual hard disk that is large enough for a Windows installation. Make sure it can be accessed by the appliance.
  5. Install the operating system and all Windows updates to make it current. Note: This machine should not be joined to the domain. Windows 2008 R2 with PVS or Horizon View: If you are installing Windows 2008 R2 for use with Citrix PVS or VMware Horizon View, install Windows Server 2008 R2 Service Pack 1 (SP1).
  6. Windows 2008 R2 with PVS or MCS: If you are installing Windows 2008 for use with PVS or MCS:
    1. Install hotfix KB2550978 on the PVS or MCS server. Note: You may need to uninstall KB3125574, before installing this one.
    2. Restart the virtual machine.
    3. Enter the commands: set devmgr_show_nonpresent_devices=1 devmgmt.msc
    4. Uninstall any dead (ghost) NICs.
    5. Reboot the system.
  7. Disable Windows System Restore and Windows Automatic Updates. The system handles restore points for you. Layer versions allow you to specify when updates occur.
  8. XenServer: If you are using XenServer, install XenServer Tools on your OS image. In most cases, the hypervisor tools are installed on the Platform layer. XenServer.is the only hypervisor for which the tools are installed on the OS layer.
  9. Hyper-V: Install Hyper-V Integration Services on this virtual machine by using the Microsoft Windows Integration Services Setup Disk.
  10. Hyper-V: Add the Remote Desktop Session Host Role:
    1. In the Hyper-V Server Manager, select Add roles and features.
    2. For the Installation Type, select Role-based or Feature-based installation.
    3. For the Server Role, select Remote Desktop Services > Remote Desktop Session Host (Installed).
    4. Complete the process of adding the Server Roles.

Windows 10

When preparing the OS image for import into an OS layer, you can speed up start times by removing Windows 10 built-in applications. If you do, we recommend removing these applications either on the OS image itself, or on the OS layer.

  1. Log into your hypervisor client.
  2. Create a virtual machine for your OS image. Important: When creating the image, be sure to choose the default cluster allocation size of 4K.
  3. Configure the virtual machine hardware settings, for example, the NIC and video memory.
  4. Disable Windows System Restore and Windows Automatic Updates: The App Layering system handles restore points for you. Layer versions allow you to control when updates occur.
  5. Log into the virtual machine.
  6. Start the local group policy editor, gpedit.msc.
  7. Select Computer Config > Administrative Templates > Windows Components > Windows Updates > Configure Automatic Updates.
  8. Set this to Disabled.
  9. If using KMS licensing, run a command window as Administrator, and enter these commands: slmgr /skms <kmsserverhost> slmgr /rearm reboot slmgr /ipk XXXX-YOUR-KMS-KEY-XXXX slmgr /ato

Important

Avoid finalizing the OS Layer while download or update processes are running, as this may cause deployed images (and every user) to experience a continuation of those operations each time they log in.

Windows 7

  1. Log into your hypervisor client.
  2. Important: Choose the default cluster allocation size of 4K
  3. Configure the virtual machine hardware settings, for example, the NIC and video memory.
  4. Disable Windows System Restore and Windows Automatic Updates. App Layering handles restore points for you, and layer versions allow you to control when updates occur.
  5. VMware: Make sure you have installed VMware Tools.

Step 2: Copy the App Layering OS Machine Tools onto the image

  1. Download the following executable file onto the OS image: App_Layering_Citrix_App_Layering_OS_Machine_Tools.zip
  2. Run the executable. Files are extracted to: c:\windows\setup\scripts

Step 3: If using Key Management Service (KMS), configure license activation scripts

If using KMS Activation, you can configure scripts for KMS activation either by creating a script file to call the correct KMS activation script when the system starts, as described in the next step.

To configure scripts for KMS, do the following.

  1. Navigate to: c:\windows\setup\scripts
  2. Run SetKMSVersion.exe as Administrator. This creates a script file in the c:\windows\setup\scripts\kmsdir folder.

When the operating system starts, the appropriate KMS activation script is executed.

Step 4: Make sure .Net Framework 3.5.1 is installed

The .Net Framework is a software framework provided by Microsoft that is required for many 3rd party applications to run. To install this feature, follow the steps below.

  1. On the Start menu, select Control Panel > Programs and Features.
  2. In the left panel select Turn Windows features on or off. A window opens.
  3. Select .NET Framework 3.5, click OK, and wait for the installation to complete. Important: Even if .NET is already installed, continue with the rest of these steps.
  4. Exit the Control Panel.
  5. In Notifications in the right-side of your taskbar, click All Settings, and open the Windows 10 Settings app.
  6. Select Settings > Update & Security.
  7. Check for updates, and install all updates available.
  8. Exit Settings.
  9. Open an administrator-level command prompt, and enter the following commands: cd \windows\Microsoft.Net\Framework\v4.nnnnn ngen update /force
  10. Wait for the command to complete, and enter the following commands: cd \windows\Microsoft.Net\Framework64\v4.nnnnn ngen update /force
  11. Exit the command prompt.

Step 5: If using PVS, remove any ghost NICs

  1. Enter the commands: set devmgr_show_nonpresent_devices= devmgmt.msc
  2. Remove any ghost NICs.
  3. Reboot the system.

Step 6: Install the App Layering services

  1. In the Citrix_App_Layering_OS_Machine_Tools folder, run the setup_x86.exe (32-bit) or setup_x64.exe (64-bit).

  2. The installation prompts for the location of the unattend.xml file (the default location is c:\windows\panther). In most cases, this can be ignored.

Once this is done, you are ready to import the image into a new OS layer.

Azure

To prepare Windows Server 2016, Windows Server 2012 R2, or Windows 10 for layering:

  • Step 1: Install the OS on a virtual machine
  • Step 2: Copy the App Layering OS Machine Tools onto the image
  • Step 3: Remove or rename unattend.wsf
  • Step 4: Install the OS Machine Tools

Step 1: Install the OS on a virtual machine

  1. In the Microsoft Azure portal, create a new virtual machine from the Windows Server Remote Desktop Session Host Windows Server 2016 or 2012 R2 image by selecting: New > Compute > Virtual Machine > From Gallery > Windows Server Remote Desktop Session Host Windows Server 2012 R2
  2. Choose Resource Manager from the Select a deployment model option list, and click Create. Note: The App Layering software does not support the Classic option from the Select a deployment model option list.
  3. Complete the Create virtual machine wizard:
    • The name of the new server machine you specify must comply with Azure naming conventions.
    • The username and password of the new server machine you specify are used for any packaging machines that are subsequently created containing this OS layer.
    • Be sure that the value for the Resource group location matches the Storage account location that you configured in the connector configuration.
  4. Reboot the machine, and log into it remotely.
  5. Turn off Windows Automatic Updates by selecting: Control Panel > System and Security > Windows Update > Change Settings
  6. Ensure that this machine is not joined to a domain.

Step 2: Copy the App Layering OS Machine Tools onto the image

  1. On the new machine, open a web browser, navigate to the Download Center and download the OS Machine Tools.
  2. Download the following zip file onto the OS image: Citrix_App_Layering_OS_Machine_Tools_4,x,x.exe
  3. Execute the file, and it copies files to: c:\windows\setup\scripts

Step 3: Install the App Layering services

  1. On the new server machine, run the setup_x64.exe file to install the App Layering drivers on the OS Machine.
  2. Ensure that this machine is not joined to a domain.
  3. Perform any pending reboots on the OS machine. This must be done before importing the OS.
  4. Make sure that the new OS machine is in one of the following states before proceeding.
    • Running
    • Stopped
    • Stopped (deallocated)

Nutanix AHV

To prepare an operating system for layering, you:

  • Step 1: Install the OS on a virtual machine
  • Step 2: Copy the App Layering OS Machine Tools onto the image
  • Step 3: If using Key Management Service (KMS), configure license activation scripts
  • Step 4: Install the OS Machine Tools

Step 1: Install the OS on a virtual machine

Windows Server 2016 R2 or Windows Server 2012 R2 image (Session Host)

  1. Log into the Prism Console.
  2. Select Task > VM, and switch to Table View to see the existing virtual machines.
  3. Click +Create VM in the upper right corner, and enter the specifics about the new virtual machine:
    1. Enter a Name and add a Description.
    2. Select the number of VCPUs.
    3. Set the Cores per CPU.
    4. Set Memory.
    5. Select Disks, and create a virtual machine with three disks. The first CD-ROM is the ISO for the OS, the second CD-ROM is for the Nutanix VIRTIO drivers that allow the Nutanix virtual machine to access the disk where you install the OS. To start, one CD-ROM is assigned.
      1. Edit the values for the assigned CD-ROM:
      2. For Operation, select Clone from ADSF file.
      3. For Bus Type, select IDE.
      4. Enter the path to your Windows ISO. The path is the combination of the Storage Container and the ISO Name. For example: /ISOStore/en_windows_10_enterprise_version_1511_x64_dvd_7224901.iso
      5. Click Update.
    6. Add another disk by clicking the +Add New Disk button:
      1. Set the Type to CDROM.
      2. Set the Operation to Clone from ADSF file.
      3. Set the Bus Type to IDE
      4. Enter the path to the Windows VIRTIO Drivers. For example: /ISOStore/virtio-win-0.1.102.iso
      5. Click Add.
    7. Click the +Add New Disk button.
      1. Set the Type to Disk.
      2. Set the Operation to Allocate on Container.
      3. Set the Bus Type to SCSI.
      4. Select the Container you want to use.
      5. Enter the Size.
      6. Click Add.
    8. Click +Add new Nic, and enter the VLAN Name.
    9. Click Save.
  4. Power on the virtual machine.
    1. Select Tasks > VM.
    2. Switch to the Table View to see existing virtual machines.
    3. Select the virtual machine in the Table, and click Power On.
  5. Launch the Console by selecting the VM and clicking Launch Console. When the VM boots it begins to install the Windows OS from the ISO disk. When the VM boots it will begin to install the Windows OS from the ISO disk.
    1. When asked, “Where do you want to install Windows?” notice that even though you added a disk in the VM creation wizard, there is no disk.
    2. Select the Load Driver option, and select Browse.
    3. Select the CD with the virtio-win-0.1.1 drivers.
    4. Select the vioscsi folder, and choose the folder for your Windows OS.
  6. After the OS is installed you will need to manually install the VirtIO drivers:
    1. Launch Device Manager.
    2. Select Other Devices, right-click Ethernet Controller and choose Update Driver Software.
    3. Browse My Computer, and choose the VirtIO CD. The ethernet drivers are stored in the NetKVM folder.
  7. Disable Windows System Restore and Windows Automatic Updates.

Windows Server 2008 R2

  1. Log into the Prism Console.
  2. Select Task > VM, and switch to Table View to see the existing virtual machines.
  3. Click +Create VM in the upper right corner, and enter the specifics about the new virtual machine:
    1. Enter a Name and add a Description.
    2. Select the number of VCPUs.
    3. Set the Cores per CPU.
    4. Set Memory.
    5. Select Disks, and create a virtual machine with three disks. The first CD-ROM is the ISO for the OS, the second CD-ROM is for the Nutanix VIRTIO drivers that allow the Nutanix virtual machine to access the disk where you install the OS. To start, one CD-ROM is assigned.
      1. Edit the values for the assigned CD-ROM:
      2. For Operation, select Clone from ADSF file.
      3. For Bus Type, select IDE.
      4. Enter the path to your Windows ISO. The path is the combination of the Storage Container and the ISO Name. For example: /ISOStore/en_windows_10_enterprise_version_1511_x64_dvd_7224901.iso
      5. Click Update.
    6. Add another disk by clicking the +Add New Disk button:
      1. Set the Type to CDROM.
      2. Set the Operation to Clone from ADSF file.
      3. Set the Bus Type to IDE
      4. Enter the path to the Windows VIRTIO Drivers. For example: /ISOStore/virtio-win-0.1.102.iso
      5. Click Add.
    7. Click the +Add New Disk button.
      1. Set the Type to Disk.
      2. Set the Operation to Allocate on Container.
      3. Set the Bus Type to SCSI.
      4. Select the Container you want to use.
      5. Enter the Size.
      6. Click Add.
    8. Click +Add new Nic, and enter the VLAN Name.
    9. Click Save.
  4. Power on the virtual machine.
    1. Select Tasks > VM.
    2. Switch to the Table View to see existing virtual machines.
    3. Select the virtual machine in the Table, and click Power On.
  5. Launch the Console by selecting the VM and clicking Launch Console. When the VM boots it begins to install the Windows OS from the ISO disk. When the VM boots it will begin to install the Windows OS from the ISO disk.
    1. When asked, “Where do you want to install Windows?” notice that even though you added a disk in the VM creation wizard, there is no disk.
    2. Select the Load Driver option, and select Browse.
    3. Select the CD with the virtio-win-0.1.1 drivers.
    4. Select the vioscsi folder, and choose the folder for your Windows OS.
  6. After the OS is installed you will need to manually install the VirtIO drivers:
    1. Launch Device Manager.
    2. Select Other Devices, right-click Ethernet Controller and choose Update Driver Software.
    3. Browse My Computer, and choose the VirtIO CD. The ethernet drivers are stored in the NetKVM folder.
  7. Disable Windows System Restore and Windows Automatic Updates.

Windows 10

  1. Log into the Prism Console. Select Task > VM, and switch to Table View to see the existing virtual machines.
  2. Click +Create VM in the upper right corner, and enter the specifics about the new virtual machine:
    1. Enter a Name and add a Description.
    2. Select the number of VCPUs.
    3. Set the Cores per CPU.
    4. Set Memory.
    5. Select Disks, and create a virtual machine with three disks. The first CD-ROM is the ISO for the OS, the second CD-ROM is for the Nutanix VIRTIO drivers that allow the Nutanix virtual machine to access the disk where you install the OS. To start, one CD-ROM is assigned.
      1. Edit the values for the assigned CD-ROM:
      2. For Operation, select Clone from ADSF file.
      3. For Bus Type, select IDE.
      4. Enter the path to your Windows ISO. The path is the combination of the Storage Container and the ISO Name. For example: /ISOStore/en_windows_10_enterprise_version_1511_x64_dvd_7224901.iso
      5. Click Update.
    6. Add another disk by clicking the +Add New Disk button:
      1. Set the Type to CDROM.
      2. Set the Operation to Clone from ADSF file.
      3. Set the Bus Type to IDE
      4. Enter the path to the Windows VIRTIO Drivers. For example: /ISOStore/virtio-win-0.1.102.iso
      5. Click Add.
    7. Click the Add New Disk button.
      1. Set the Type to Disk.
      2. Set the Operation to Allocate on Container.
      3. Set the Bus Type to SCSI.
      4. Select the Container you want to use.
      5. Enter the Size.
      6. Click Add.
    8. Click Add new Nic, and enter the VLAN Name.
    9. Click Save.
  3. Power on the virtual machine.
    1. Select Tasks > VM.
    2. Switch to the Table View to see existing virtual machines.
    3. Select the virtual machine in the Table, and click Power On.
  4. Launch the Console by selecting the VM and clicking Launch Console. When the VM boots it begins to install the Windows OS from the ISO disk. When the VM boots it will begin to install the Windows OS from the ISO disk.
    1. When asked, “Where do you want to install Windows?” notice that even though you added a disk in the VM creation wizard, there is no disk.
    2. Select the Load Driver option, and select Browse.
    3. Select the CD with the **virtio-win-0.1.1 **drivers.
    4. Select the vioscsi folder, and choose the folder for your Windows OS.
  5. After the OS is installed you will need to manually install the VirtIO drivers:
    1. Launch Device Manager.
    2. Select Other Devices, right-click Ethernet Controller and choose Update Driver Software.
    3. Browse My Computer, and choose the VirtIO CD. The ethernet drivers are stored in the NetKVM folder.
  6. Disable Windows System Restore and Windows Automatic Updates. The Unidesksystem handles restore points for you, and Unidesk layer versions allow you to control when updates occur.
  7. Install a flag file to enable the shutdown of the OS.
  8. Disable Windows System Restore and Windows Automatic Updates:
  9. Log into the virtual machine.
    1. Select Computer Config > Administrative Templates > Windows Components > Windows Updates > Config Auto Updates.
    2. Set this to Disabled.
    3. The App Layering system handles restore points for you, and layer versions allow you to control when updates occur.
  10. If using KMS licensing, run a command window as Administrator, and enter these commands:
    • slmgr /skms <kmsserverhost
    • > slmgr /rear
    • mreboot
    • slmgr /ipk XXXX-YOUR-KMS-KEY-XXX
    • Xslmgr /ato
  11. If you want to remove Store Apps using the Remover store apps script, do so now.

Windows 7

  1. Log into the Prism Console. Select Task > VM, and switch to Table View to see the existing virtual machines.
  2. Click +Create VM in the upper right corner, and enter the specifics about the new virtual machine:
    1. Enter a Name and add a Description.
    2. Select the number of VCPUs.
    3. Set the Cores per CPU.
    4. Set Memory.
    5. Select Disks, and create a virtual machine with three disks. The first CD-ROM is the ISO for the OS, the second CD-ROM is for the Nutanix VIRTIO drivers that allow the Nutanix virtual machine to access the disk where you install the OS. To start, one CD-ROM is assigned.
      1. Edit the values for the assigned CD-ROM:
      2. For Operation, select Clone from ADSF file.
      3. For Bus Type, select IDE.
      4. Enter the path to your Windows ISO. The path is the combination of the Storage Container and the ISO Name. For example: /ISOStore/en_windows_10_enterprise_version_1511_x64_dvd_7224901.iso
      5. Click Update.
    6. Add another disk by clicking the +Add New Disk button:
      1. Set the Type to CDROM.
      2. Set the Operation to Clone from ADSF file.
      3. Set the Bus Type to IDE
      4. Enter the path to the Windows VIRTIO Drivers. For example: /ISOStore/virtio-win-0.1.102.iso
      5. Click Add.
    7. Click the +Add New Disk button.
      1. Set the Type to Disk.
      2. Set the Operation to Allocate on Container.
      3. Set the Bus Type to SCSI.
      4. Select the Container you want to use.
      5. Enter the Size.
      6. Click Add.
    8. Click +Add new Nic, and enter the VLAN Name.
    9. Click Save.
  3. Power on the virtual machine.
    1. Select Tasks > VM.
    2. Switch to the Table View to see existing virtual machines.
    3. Select the virtual machine in the Table, and click Power On.
  4. Launch the Console by selecting the VM and clicking Launch Console. When the VM boots it begins to install the Windows OS from the ISO disk. When the VM boots it will begin to install the Windows OS from the ISO disk.
    1. When asked, “Where do you want to install Windows?” notice that even though you added a disk in the VM creation wizard, there is no disk.
    2. Select the Load Driver option, and select Browse.
    3. Select the CD with the virtio-win-0.1.1 drivers.
    4. Select the vioscsi folder, and choose the folder for your Windows OS.
  5. After the OS is installed you will need to manually install the VirtIO drivers:
    1. Launch Device Manager.
    2. Select Other Devices, right-click Ethernet Controller and choose Update Driver Software.
    3. Browse My Computer, and choose the VirtIO CD. The ethernet drivers are stored in the NetKVM folder.
  6. Disable Windows System Restore and Windows Automatic Updates.

Step 2: Copy the OS Machine Tools onto the image

  1. Download the following executable file onto the OS image: Citrix_App_Layering_OS_Machine_Tools.exe
  2. Run the executable. Files are saved to: c:\windows\setup\scripts

Step 3: If using Key Management Service (KMS), configure license activation scripts

If using KMS Activation, you can configure scripts for KMS activation either by creating a script file to call the correct KMS activation script when the system starts, or by running the Unattend file included in the App Layering OS Machine Tools download, as described in the next step.

To configure scripts for KMS, do the following.

  1. Navigate to: c:\windows\setup\scripts
  2. Run SetKMSVersion.exe as Administrator. This creates a script file in the c:\windows\setup\scripts\kmsdir folder.

When the operating system starts, the appropriate KMS activation script is executed.

Step 4: Install the App Layering services

  1. In the Citrix_App_Layering_OS_Machine_Tools folder, run the setup_x86.exe (32-bit) or setup_x64.exe (64-bit).

  2. The installation prompts for the location of the unattend.xml file (the default location is c:\windows\panther).

Once this is done, you are ready to import the image into a new OS Layer.

Optional OS preparation tools

The App Layering installation package includes an optimization script that is particularly helpful for making it easier to layer Microsoft Office.

In the rare case that you need to run Windows Mini Setup using an unattend.hta file, you should use the unattend.hta included in the App Layering download to create an unattend answer file.

OS Optimization Script

The Optimization script creates a file that sets up scripts and allows for easier layering of Microsoft Office. It allows you to save memory and CPU by disabling services you don’t need and removing installation-specific drivers and settings. It also enables services you need.

  1. In the c:\windows\setup\scripts folder, run the optimizations.cmd file to create a file that will be run when the image is created.

  2. If you run the Unattend.hta file, the optimizations.cmd file is run automatically. If you run optimizations.cmd without first running Unattend.hta, follow the instructions to run it on the OS Image.

    If you are using the Optimizations script and you are enabling the View Persona feature, you must go to the section of the script called Disable Unnecessary Services to Save Memory and CPU, deselect the option to Disable Offline File Service, and click Save File. This is because View Persona folder redirection requires Offline files to be enabled, and by default, the optimization script turns off any offline files that are not a requirement for App Layering.

Answer file for unattended installation (Unattend.hta)

In the rare case that you need to run Windows Mini Setup with an Unattend.hta file, use these steps.

  1. In the c:\windows\setup\scripts folder, right-click the unattend.hta tool and choose Run as administrator. The unattend builder form opens.
  2. Complete the unattend form.Product key activation.
    • For KMS activation, select KMS Server.
      • For KMS with a Multiple Activation Key (MAK), select KMS with MAK and enter the MAK.
      • For Retail Licensing with a MAK, select Retail with MAK, and the MAK.
    • Local Administrator account
      • If you want to use the unattend.xml file to enable the Administrator account on each Layered Image, select Enable. Remember to also enable this account in your OS Image or Operating System Layer revision. It is possible to enable the Administrator account for your OS Image and then have it disabled in the deployed Layered Images by clearing the check box
      • If you want to add an alternate Administrator account, select Enable and enter the account information. This account cannot be pre-configured in the OS Image.
      • You can create a Layered Image where the Administrator is disabled and the alternate administrator is created and enabled. However for this to work, the Administrator account must be enabled in the OS Image and it cannot be renamed.
    • Time zone
      • Select the time zone. If your time zone is not listed, you can add it to the Other box. Be sure to use the time zone, not the display setting. A list of time zone settings can be found in Microsoft TechNet.
    • Disabling automatic activation
      • Select this option if you plan to use the Microsoft Volume Activation Management Tool.
  3. Click Save File.