Product Documentation

OS layer

Jan 11, 2018

This topic explains how to:

  • Prepare a new operating system image for layering
  • Import the image into a new OS Layer

After creating the OS layer, you can use it 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 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, in this case, Hyper-V. When you start with a fresh image, the operating system is partially optimized for your environment.
  • Ensure that the operating system image is not in a domain and that it gets its IP address from DHCP.
  • Ensure that the virtual machine for your OS Layer is MBR partitioned, rather than GPT partitioned. Otherwise, you cannot install the Citrix App Layering OS Machine Tools.
  • Using third-party optimization scripts can have adverse effects for layering. The scripts can change services and features that the App Layering service uses such as Universal Plug and Play and the 8.3 file names setting. Use the optimization tools in the installer download to optimize your image.

Prepare the image for layering

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

STEP 1: Set up a fresh Image on a virtual machine

In the Hyper-V client:

Create a Generation 1 virtual machine.

Configure memory and networking, for example, the network adapter and video memory.

Note

You can have one network device in your gold image.

Configure a virtual hard disk that is large enough for a Windows operating system installation. Ensure that it is accessible by the App Layering appliance.

Install the operating system and patches to make it current.

Note

This machine is not joined to the domain.

Install Hyper-V Integration Services on this virtual machine by using the Microsoft Windows Integration Services Setup Disk.

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

Using Server Manager, add the Remote Desktop Session Host Role to the machine.

Important

Do this step as a Role-based or Feature-based installationnot as a Remote Desktop Services installation.

  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.

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

  1. Copy the OS_Image_Tools RAR file onto the gold image. You can find these tools in the installer download.
  2. Run the RAR file, which copies the tools to the C:windows\setup\scripts directory.

STEP 4: (Optional) Configure Scripts for KMS Activation

You can configure scripts for KMS activation by using one of the following methods:

  • Create a script file to call the correct KMS activation script when the system starts.
  • Run the Unattend file included in the Citrix App Layering OS Machine Tools download.

To configure scripts for KMS

  1. In the c:\windows\setup\scripts folder, run SetKMSVersion.exe as an administrator. Running SetKMSVersion.exe creates a script file in the c:\windows\setup\scripts\kmsdir folder to call the appropriate KMS activation script when the operating system starts.

STEP 5: Install the Citrix App Layering OS Machine Tools onto the image

  1. In the c:\windows\setup\scripts folder, run the setup_x64.exe (64-bit).
  2. When prompted, provide the location of the App Layering appliance IP address and the location of the unattend.xml file. The default location is c:\windows\panther.

After the installation finishes, you can create an OS Layer.

Prepare a Windows Server 2008 R2 image (Session Host)

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

In the Hyper-V client:

Create a Generation 1 machine.

Configure memory and networking, for example, the network adapter and video memory.

Note

You can have one network device in your gold image.

Configure a virtual hard disk that is large enough for a Windows operating system installation. Ensure that it is accessible by the App Layering appliance.

Install Windows Server 2008 R2 and any available patches.

Note

Do not join the server to the domain.

Install Hyper-V Integration Services on this virtual machine by using the Microsoft Windows Integration Services Setup Disk.

STEP 2: Add the Remote Desktop Session Host Role

Using Server Manager, add the Remote Desktop Session Host Role to the machine.

  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.

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

  1. Copy the OS_Machine_Tools RAR file onto the gold image. You can find these tools in the installer download.
  2. Run the RAR file, which copies the tools to the C:windows\setup\scripts directory.

STEP 4: (Optional) Configure Scripts for KMS Activation

You can configure scripts for KMS activation by using one of the following methods:

  • Create a script file to call the correct KMS activation script when the system starts.
  • Run the Unattend file included in the Citrix App Layering OS Machine Tools download.

To configure scripts for KMS

  1. In the c:\windows\setup\scripts folder, run SetKMSVersion.exe as an administrator. The application creates a script file in the c:\windows\setup\scripts\kmsdir folder to call the appropriate KMS activation script when the operating system starts.

STEP 5: Install the Citrix App Layering OS Machine Tools onto the image

  1. In the c:\windows\setup\scripts folder, run the setup_x64.exe (64-bit).
  2. When prompted, provide the location of the App Layering appliance IP address and the location of the unattend.xml file. The default location is c:\windows\panther.

When the setup file finishes running, you can create an OS layer.

Prepare a Windows 10 image

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

In the Hyper-V client:

Create a virtual machine for your operating system image.

Important

When you create the image, choose 4k as the default cluster allocation size.

Configure the virtual machine hardware settings. For example, the network adapter and video memory.

Disable Windows System Restore and Windows Automatic Updates:

  1. Log on to the virtual machine.
  2. Select Computer Config > Administrative Templates > Windows Components > Windows Updates > Config Auto Updates.
  3. Select Disabled.

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

If you use KMS licensing, open a command window as an administrator and type the following commands:

Commands Copy

slmgr /skms <kmsserverhost>
slmgr /rearm
reboot
slmgr /ipk XXXX-YOUR-KMS-KEY-XXXX
slmgr /ato

Install VMware Tools on the operating system image.

If you include the Windows Store in your Windows 10 image, get the latest updates for all the store apps.

  1. Start the Windows Store application and log on.
  2. On the Windows Store page, select Downloads and Updates.
  3. Check for updates and then click Update All. Repeat this step two times to ensure installing the latest updates.

Important

Do not finalize the OS Layer when download or update processes are running. If you do before the updates finish downloading and installing, these items continue the process each time deployed images and users log on.

STEP 2: Copy the Operating System Machine Tools onto the Operating System 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

You can configure scripts for KMS activation by using one of the following methods:

  • Create a script file to call the correct KMS activation script when the system starts.
  • Run the Unattend file included in the Citrix App Layering OS Machine Tools download.

To configure scripts for KMS

  1. In the c:\windows\setup\scripts folder, run SetKMSVersion.exe as an administrator. The application creates a script file in the c:\windows\setup\scripts\kmsdir folder to call the appropriate KMS activation script when the operating system starts.

STEP 4: Install .Net Framework 3.5.1

The .Net Framework is a software framework provided by Microsoft that is required for many third-party applications to run. To install this feature, use the following steps:

On the Start menu, select Control Panel > Programs and Features.

In the left panel, select Turn Windows features on or off. A window opens.

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.

Close Control Panel.

In Notifications on the right-side of your taskbar, click All Settings, and open the Windows 10 Settings app.

Select Settings > Update & Security.

Check for updates and install all available updates.

Close Settings.

Open a command prompt as an administrator, and type the following commands:

Commands Copy

cd \windows\Microsoft.Net\Framework\v4.nnnnn
ngen update /force

Wait for the command to complete, and then type the following commands:

Commands Copy

cd \windows\Microsoft.Net\Framework64\v4.nnnnn
ngen update /force

Close the command window.

STEP 5: If using Provisioning Services, follow these steps to avoid ghost network adapters

At a command prompt, type the following:

Commands Copy

set devmgr_show_nonpresent_devices=
devmgmt.msc

Remove any ghost network adapters.

Restart the system.

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

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

When the script finishes running, you can create an OS Layer.

Prepare a Windows 7 image

STEP 1: Set up a Windows image on a virtual machine in the Hyper-V client

Create a Generation 1 virtual machine.

Configure memory and networking.

Note

You can have one network device in your operating system image.

Configure a virtual hard disk that is large enough for a Windows operating system installation. Ensure that it is accessible by the App Layering appliance.

Install the desktop operating system that you want to use on the virtual machine.

Install the Hyper-V Integration Services in this virtual machine, using the Microsoft Windows Integration Services Setup Disk.

STEP 2: Add the Remote Desktop Session Host Role

Using Server Manager add the Remote Desktop Session Host Role to the machine.

Important

Do this step as a Role-based or Feature-based installation, not as a Remote Desktop Services installation.

  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.

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

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

STEP 4: (Optional) Configure Scripts for KMS Activation

If using KMS Activation, you can configure scripts for KMS activation by using one of the following methods:

  • Create a script file to call the correct KMS activation script when the system starts.
  • Run the Unattend file included in the Citrix App Layering OS Machine Tools download.

To configure scripts for KMS

  1. In the c:\windows\setup\scripts folder, double-click the file SetKMSVersion.exe and run it as an administrator. After the file finishes running, a script file appears in the c:\windows\setup\scripts\kmsdir folder. The script file calls the appropriate KMS activation script when the OS starts.

STEP 5: Install the tools onto the OS Image

  1. In the 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).

After the procedure runs, you can create an OS layer.

Import the operating system image into a new OS Layer

To import an operating system disk

In the management console, select Layers > OS Layers and then click Create OS Layer in the Action bar. The Create Operating System Layer Wizard opens.

On the Layer Details tab, specify a Layer Name and Version, both required values. Optionally, you can type Descriptions for the Layer and Version. You can also change the Max Layer Size to accommodate the operating system you import. 

On the Connector tab, choose a Connector Configuration for the platform where you publish your Layered Images. If the configuration you need is not listed, add a New one and select it from this list. For information about creating a Platform Connector Configuration, see Create a Connector Configuration.

Note

If you have a VHD file of the operating system disk in your network file share, select the file share.

On the Import Disk Details tab, type the name of the operating system disk on that file share. You can also click Browse to navigate to the disk.

On the Icon Assignment tab, select an icon image to assign to this Layer.

On the Confirm and Complete tab, review the details of the OS Layer. Type a comment if necessary, and then click Create Layer. If you added comments, they appear in the Information view Audit History.

When the task is done, the new OS Layer appears in the management console with a status "Deployable."

Optional tools for optimizing the operating system

Create an answer file for unattended installation (Optional)

To run Windows Mini-Setup with an Unattend.hta file, use these steps.

  1. Navigate to the folder c:\windows\setup\scripts folder.
  2. Right-click the unattend.hta tool and click Run as administrator. The unattend builder form opens.
  3. 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 then type the MAK.
      • For Retail Licensing with a MAK, select Retail with MAK, and then type 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. Also, enable this account in your operating system image or OS Layer revision. You can enable the administrator account for your operating system image and then disable it in the deployed Layered Images by clearing the check box.
      • If you want to add a different administrator account, select Enable and then type the account information. You cannot pre-configure this account in the OS Image.
      • You can create a Layered Image where you disable the primary administrator and then create and enable a different administrator. Enable the administrator account in the operating system image. You cannot rename the administrator account.
    • Time zone
      • Select the time zone. If your time zone is not listed, you can add it to the Other box. Use the time zone, not the display setting. You can find a list of time zone settings here.
    • Disabling automatic activation
      • Choose this option if you plan to use the Microsoft Volume Activation Management Tool.
  4. 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. The script 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 runs when you create the image.

  2. If you run the Unattend.hta file, the optimizations.cmd file runs automatically. If you run optimizations.cmd without first running Unattend.hta, follow the instructions to run it on the operating system image. 

    If you use the Optimizations script and enable the View Persona feature, update the script section called Disable Unnecessary Services to Save Memory and CPU. Clear the option to Disable Offline File Service and then click Save File. The View Persona folder redirection requires you to enable Offline files. By default, the optimization script turns off any offline files that are not a requirement for App Layering.