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

  • Start with a fresh operating system image, 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. Otherwise, you will not be able to install the Citrix App Layering OS Machine Tools.
  • Using Third-party optimization scripts can have adverse effects for layering, as they can change services and features that the App Layering service 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.

Prepare your OS image for layering

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

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

In the Prism Console:

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

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

  1. In the c:\windows\setup\scripts folder run SetKMSVersion.exe as Administrator. This creates a script file in the c:\windows\setup\scripts\kmsdir folder to call the appropriate KMS activation script when the OS starts.

STEP 4: Install the OS Machine Tools onto the OS Image

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

Once this is done, you are ready to create an OS Layer.

Prepare a Windows Server 2008 R2 image

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

In the Prism Console:

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

STEP 2: Copy the OS Machine Tools onto the OS Image

  1. Download the App_Layering_Citrix_App_Layering_OS_Machine_Tools ZIP file onto the OS Image.
  2. Extract the 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 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.exe as Administrator. This creates a script file in the c:\windows\setup\scripts\kmsdir folder to call the appropriate KMS activation script when the OS starts.

STEP 4: Install the OS Machine 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).

Once this is done, you are ready to create an 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 Windows 10 built-in applications. If you do, we recommend removing these applications either on the OS Image itself, or on the OS Layer.

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

In the Prism Console:

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

  1. In the c:\windows\setup\scripts folder run SetKMSVersion.exe as Administrator. This creates a script file in the c:\windows\setup\scripts\kmsdir folder to call the appropriate KMS activation script when the OS starts.

STEP 4: Install the OS Machine 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).

Once this is done, you are ready to create an OS Layer.

Prepare a Windows 7 image

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

In the Prism Console:

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

STEP 2: Mount or 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 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.exe as Administrator. This creates a script file 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 Citrix App Layering OS Machine 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).

Once this is done, you are ready to create an OS layer.

Import the image into a new OS layer

  1. In the appliance, select Layers > OS Layers and click Create OS Layer in the Action bar. This opens the Create Operating System Layer Wizard.
  2. In the Layer Details tab, specify a Layer Name and Version, both required values. 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, choose a Nutanix AHV Connector Configuration that specifies where your clean OS is located. If the configuration you need is not listed, add a New one and then select it from this list. For information about adding this Connector Configuration, see Create a Connector Configuration.
  4. In the OS Disk Details tab, click the Select Virtual Machine field. The Virtual Machine field appears.
  5. Click in the Virtual Machine field to reveal a list of all VMs.
  6. Select a VM from the list, or start by typing the name to filter the list to VMs that contain the search text, and then select the VM.
  7. Click OK. The selected VM is validated to ensure that:

    • The VM has a single OS disk attached as a SCSI disk. (Attaching the OS disk as IDE is not supported.)
    • The OS disk can be downloaded via the storage container where that disk resides. The storage container housing the OS disk:
      • Does not need to be the same as the configured storage container.

      • Must be configured so the appliance is in its white list of clients allowed to perform an NFS mount. If the appliance does not have permissions to mount the VM's storage container, you must correct this through the Nutanix UI.

    • If there are problems with the VM or OS Disk, an error is displayed. Otherwise, you are returned to the wizard where the VM's name, and the size of the OS disk are listed.

  8. In the Icon Assignment tab, select an icon image to assign to this Layer.
  9. 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.

When the task completes, the new OS Layer in the Management Console displays a "Deployable" status.

Other tools for optimizing the operating system

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.