Product Documentation

OS layer

Jan 11, 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 Layered Images as you need.

The OS layer is a virtual disk attached to a virtual machine running the supported Windows Operating System that you want to use for your Layered Images.

Before you start

When you prepare the OS Image for import:

  • Start with an OS that has been freshly installed from ISO, preferably from your hypervisor, so that the operating system is partially optimized for your environment.
  • Make sure that the OS Image is not in a domain, and that it gets its IP address from DHCP.
  • Ensure that the VM for your OS Layer is MBR partitioned, rather than GPT partitioned. This is required for installing the Citrix App Layering OS Machine Tools.
  • The Paravirtual SCSI controller is not supported. You must use the default controller (SCSI BusLogic). The LSI Logic SAS controller type is supported. If you change the SCSI controller type to anything else, the OS Layer import will fail.
  • Avoid using third-party optimization scripts, because they can change services and features that the App Layering software uses, for example, Universal Plug and Play and the 8.3 file names setting. Use the optimization tools in the Installer download to optimize your image.
  • Whether creating a new Windows 10 OS Layer or adding a new Version to an existing Layer, always include the latest Windows Store App updates in the OS Layer. Normally, Windows 10 pulls App updates gradually over time, but this can also be initiated manually through the Windows Store application. These updates are important because they establish the Store Apps available to all users of the deployed image. Users will not have the ability to update or install new Store Apps with persistence. Details are included in the steps for Windows 10 below.
  • Locate the OS Machine Tools in the App Layering download package.

Which operating system are you using?

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

STEP 1: Set up a Windows Server 2016 R2 or Windows Server 2012 R2 OS Image on a virtual machine

In the vSphere client:

  1. Create a VM for the OS image.
  2. Configure the virtual machine hardware settings, for example, the NIC and video memory.

    Important: You can have just one network device for the virtual machine, and it must be the VMXNET 3 network adapter, as the default E1000 adapter (or even a ghost NIC leftover from an E1000 adapter) can cause customization timeout errors on the VM when attempting to boot the image in environments such as Citrix PVS, Citrix MCS, or VMware Horizon View.

  3. Configure a virtual hard disk that is large enough for a Windows operating system installation, and make sure it is accessible by the Management Appliance.

  4. Install the Windows operating system and all Windows updates.

    Important: You must install the Windows updates before moving to the next step..

  5. Disable Windows System Restore and Windows Automatic Updates. The App Layering system handles restore points for you, and layer versions allow you to control when updates occur.

  6. Install VMware Tools on your OS image.

STEP 2: Copy the Citrix App Layering OS Machine Tools onto the OS Image

  1. Download the Citrix_App_Layering_OS_Machine_Tools ZIP file onto the OS Image.
  2. Extract the citrix_app_layering_os_machine_tools_x.x.x to c:\windows\setup\scripts.

STEP 3: (Optional) Configure Scripts for KMS Activation

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 Citrix App Layering OS Machine Tools download, as described in the next step. To configure scripts for KMS:

  • In the c:\windows\setup\scripts folder run SetKMSVersion.hta as an administrator. A script file appears in the c:\windows\setup\scripts\kmsdir folder to call the appropriate KMS activation script when the OS starts.

STEP 4: Install the App Layering tools onto the image

  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).

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

Prepare a Windows 2008 R2 image

STEP 1: Set up a Windows Server 2008 R2 OS Image on a virtual machine

In the vSphere client:

  1. Create a VM for your OS image, making sure to choose the default cluster allocation size of 4K.

  2. Configure the virtual machine hardware settings, for example, the NIC and video memory.

    Important: You can have just one network device for the virtual machine, and it must be the VMXNET 3 network adapter, as the default E1000 adapter (or even a ghost NIC leftover from an E1000 adapter) can cause customization timeout errors on the VM when attempting to boot the image in environments such as Citrix PVS, Citrix MCS, or VMware Horizon View.

  3. If you are using Citrix PVS or VMware Horizon View, install Windows Server 2008 R2 Service Pack 1 (SP1).

    Notes:

    • If you do not install SP1, an error occurs when you try to install View Agent in the virtual machine.
    • When creating the image, be sure to choose the default cluster allocation size of 4K.
  4. If using PVS:

    1. In the VM properties, make sure the PCI slot number is 192, as shown below (mouse over the image to enlarge it):

    2. Install KB2550978 hotfix:

      https://support.microsoft.com/en-us/kb/2550978

    3. Run cmd as Administrator, and enter the following commands:

      set devmgr_show_nonpresent_devices=1
      run devmgmt.msc in the same cmd window

      Note: You must run these commands, or the next command will not show hidden devices (ghost NICs)

    4. Select View >Show hidden devices in Device Manager. This shows dead NICs as grayed out.

    5. Uninstall the dead NIC and reboot the system.
  5.  Install VMware Tools on the OS image.

STEP 2: Copy the Citrix App Layering OS Machine Tools onto the image

  1. Download the Citrix_App_Layering_OS_Machine_Tools ZIP file onto the OS Image.
  2. Extract the citrix_app_layering_os_machine_tools_x.x.x to c:\windows\setup\scripts.

STEP 3: (Optional) Configure Scripts for KMS Activation

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 Citrix App Layering OS Machine Tools download, as described in the next step. To configure scripts for KMS:

  • In the c:\windows\setup\scripts folder run SetKMSVersion.hta as an administrator. A script file appears in the c:\windows\setup\scripts\kmsdir folder to call the appropriate KMS activation script when the OS starts.

STEP 4: Install the App Layering tools onto the OS Image

  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).

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

Prepare a Windows 10 image

When preparing the OS Image for import into an OS Layer, you can speed up start times by removing the Windows 10 Store. If you do, we recommend removing this either on the OS Image itself before importing it, or on the OS Layer.

If you include the Store, be sure to get the latest version of all Store Apps, whether you are creating a new OS Layer or adding a Version to it.

STEP 1: Set up a Windows 10 image on a virtual machine

In the vSphere client:

  1. Create a VM for your OS image.

    Important: When creating the image, be sure to choose the default cluster allocation size of 4K.

  2. Configure the virtual machine hardware settings, for example, the NIC and video memory.

  3. Disable Windows System Restore and Windows Automatic Updates:

    1. Log into the VM.

    2. Select Computer Config > Administrative Templates > Windows Components > Windows Updates > Config Auto Updates.
    3. Set this to Disabled.

    The App Layering system handles restore points for you, and layer versions allow you to control when updates occur.

  4. 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

  5. Install the VMware Tools on the OS image.

  6. If you are including the Windows Store in your Windows 10 image, get the latest updates for all Store Apps.

    1. Launch the Windows Store application, click the Sign in icon (top right), then select Downloads and Updates.

    2. Check for Updates, and click Update All. This should be repeated at least twice to ensure that the latest updates have been pulled.

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.

STEP 2: Copy the Citrix App Layering OS Machine Tools onto the image

  1. Download the Citrix_App_Layering_OS_Machine_Tools ZIP file onto the OS Image.
  2. Extract the citrix_app_layering_os_machine_tools_x.x.x to c:\windows\setup\scripts.

STEP 3: (Optional) Configure Scripts for KMS Activation

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 Citrix App Layering OS Machine Tools download, as described in the next step. To configure scripts for KMS:

  • In the c:\windows\setup\scripts folder run SetKMSVersion.hta as an administrator. A script file appears in the c:\windows\setup\scripts\kmsdir folder to call the appropriate KMS activation script when the OS starts.

STEP 4: Install .Net Framework 3.5.1

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, follow these steps to avoid ghost NICs

  1. Enter the commands:

    set devmgr_show_nonpresent_devices=1
    devmgmt.msc

  2. Remove any ghost NICs.

  3. Reboot the system.

STEP 6: Install the Citrix App Layering software onto the OS Image

  • Run setup_x64.exe from c:\Windows\setup\scripts.

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

Prepare a Windows 7 image

STEP 1: Set up a Windows 7 OS Image on a virtual machine

In the vSphere client:

  1. Create a VM for your OS Image.

    Important: When creating the image, be sure to choose the default cluster allocation size of 4K.

  2. Configure the virtual machine hardware settings, for example, the NIC and video memory.

  3. Disable Windows System Restore and Windows Automatic Updates. The App Layering system handles restore points for you, and layer versions allow you to control when updates occur.

  4. Make sure you have installed VMware Tools on the OS image.

STEP 2: Mount or copy the OS Machine Tools onto the image

  1. Download the Citrix_App_Layering_OS_Machine_Tools ZIP file onto the OS Image.
  2. Extract the citrix_app_layering_os_machine_tools_x.x.x to c:\windows\setup\scripts.

STEP 3: (Optional) Configure Scripts for KMS Activation

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 Citrix App Layering OS Machine Tools download, as described in the next step. To configure scripts for KMS:

  • In the c:\windows\setup\scripts folder run SetKMSVersion.hta as an administrator. A script file appears in the c:\windows\setup\scripts\kmsdir folder to call the appropriate KMS activation script when the OS starts.

STEP 4: If using PVS, follow these steps to avoid ghost NICs

  1. Install KB2550978 hotfix.
  2. Reboot the VM,
  3. Enter the commands:

    set devmgr_show_nonpresent_devices=1
    devmgmt.msc

  4. Remove any ghost NICs.
  5. Reboot the system.

STEP 5: Install the App Layering software onto the image

  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.

Import the image into a new OS layer

  1. In the Management Console, select Layers > OS Layers and click Create OS Layer in the Action bar. This opens the Create OS Layer Wizard.
  2. In the Layer Details tab, specify a Layer Name and Version, both required values. Optionally, you can enter Descriptions of the Layer and Version, and change the Max Layer Size to accommodate the OS you are going to import.
  3. In the Connector tab, select a Connector Configuration that specifies the location of your clean OS image. If the configuration you need is not listed, add a New one, and then select it from this list. For details about adding this Connector Configuration, see Create a Connector Configuration.
  4. In the OS Disk Details tab, click Select Virtual Machine. This opens a new browser tab.
  5. Click in the Virtual Machine field to reveal a list of all available virtual machines. Select a virtual machine from the list, or start typing the name to filter the list, and select the machine.
  6. Click OK. The selected virtual machine is validated to ensure that the machine has a single OS disk attached as a SCSI disk. (Attaching the OS disk as IDE is not supported.)
    If there are problems with the virtual machine or OS disk, an error is displayed. Otherwise, you are returned to the wizard where the machine name and the size of the OS disk are listed.
  7. In the Icon Assignment tab, select an icon image to assign to this Layer.
  8. In the Confirm and Complete tab, review the details of the OS Layer, enter a comment if required, and click Create Layer. If you enter comments, they appear in the Information view Audit History.
  9. When the task completes, the new OS Layer in the Management Console displays a "Deployable" status.

Tools for optimizing the operating system (Optional)

Create an answer file for unattended installation (Optional)

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 here.
    • Disabling automatic activation
      • Select this option if you plan to use the Microsoft Volume Activation Management Tool.
  3. Click Save File.

Optimize the OS Image for layering (Optional)

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 CPUdeselect 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.