Product Documentation

For publishing to Citrix PVS in Hyper-V

Jan 11, 2018

This article explains how to create a Platform layer that allows your layered images to run flawlessly when deployed to Citrix PVS running in Hyper-V.  


When creating a Platform Layer, the PVS installer must be available in a location that's accessible to the Packaging Machine where you are creating the Layer.

Citrix Provisioning Service prerequisites

  • IPv6 must be disabled on the OS Layer.

    If IPv6 is not disabled on your OS Layer, add a new Version to the OS Layer and disable IPv6 in the new Version.

    IMPORTANT: If you disable IPv6 on the Platform Layer instead of on the OS Layer, the resulting PVS machines will lose their network connection and hang when they are booted.

  • App Layering Agent

    The Agent must be installed on all PVS servers used to access the PVS servers to which you will publish images. (Each Agent must be registered with the App Layering appliance.)

  • PVS servers where the Agent is installed

    The PVS Console must be installed on all PVS servers where the Agent is installed.

  • PVS Target Device Imaging software

    The PVS Target Device Imaging software must be available to install on the Platform Layer. The version must match the PVS server where the Layered Image will be published.

  • PVS resource information

    The PVS info listed in this PVS Connector Configuration topic.

  • PowerShell Snap-in

    Appropriate PowerShell Snap-in must be installed.

  • Unique CMID for each target device (if using KMS)

    When using KMS licensing, PVS requires that each target device has a unique CMID. For the full story, check out this Citrix article, Demystifying KMS and Provisioning Services. Rearming KMS is covered in the steps to Create a Platform Layer.

  • Any additional PVS settings you use in your environment

    Any settings you need to configure PVS on your Platform Layer so that it matches the environment where the Layered Image will be used.

Connection Broker prerequisites

You need any installers, tools, and settings required to run your connection broker in Hyper-V. 

Other prerequisites

You may also need the following resource information and settings:

  • KMS settings

    If you are using KMS licensing, you need the KMS settings.

  • Hyper-V resource information and settings

If you are extending your use of App Layering from another hypervisor to a Hyper-V environment, and the Hyper-V settings and resources are not configured on your OS layer, you must be prepared to configure the Hyper-V resources and settings on the Platform layer. For more about the Hyper-V resource information required, see Hyper-V connector configuration.  

Prepare a new platform layer

  1. Select Layers > Platform Layers and select Create Platform Layer in the Action bar. This opens the Create Platform Layer wizard.

  2. In the Version Details tab:
    1. (Required) Enter a name for the New Version. This can be the software version or other identifying information.
    2. If you are adding a version to an existing layer, the Base Version field lets you choose which version to use as the starting point. The default choice is the latest version.
  3. In the OS Layer tab, select the OS Layer you want to associate with this Platform Layer.

  4. In the Connector tab, choose a PVS Connector Configuration if you have one. Otherwise, select New Connector Configuration and create one.

  5. In the Platform Types tab, select This platform will be used for publishing layered images, and the Hypervisor, Provisioning Service, and Connection Broker to which you will be publishing the Layered Image.

     If you are not using a Provisioning Service or a Connection Broker, select None in that field.

  6. In the Packaging Disk tab, enter a file name for the Packaging Disk, and select the disk format. This disk will be used for the Packaging Machine (the virtual machine) where you will install the tools, as described in the next two sections.

  7. In the Icon Assignment tab, select an icon to assign to the layer. This icon represents the layer in the Layers Module.

    • To use an existing image, select an image in the image box.
    • To import a new image, click Browse and select an image in PNG or JPG format.
  8. In the Confirm and Complete tab, review the details of the App Layer, enter a comment if required, and click Create Layer. Any comments you enter will appear in the Information view Audit History.

  9. Expand the Tasks bar at the bottom of the UI, and double-click the Packaging Disk task to show the full task description.

    Once the Packaging Disk has been created, the Task details include the location of the Packaging Disk in your environment.

Next, you can log into the Packaging Machine for your Layer.

Deploy a Packaging Machine in Hyper-V

The Packaging Machine is a virtual machine where you install the tools for your environment. In the Management Console, the Task Description includes the location of the Packaging Machine in your environment.

Note: The Packaging Machine is temporary, and will be deleted once the new Platform Layer has been finalized.

  1. Log into Hyper-V, so that you can use the link to the Packaging Machine supplied in the next step.
  2. In the Management Console, expand the Task Panel, and then the Packaging Disk task. The task detail includes a link to the Packaging Machine.
  3. Navigate to the Packaging Machine using the link provided in the Packaging Disk task.
  4. In Hyper-V, power on the Packaging Machine.

Install the platform tools on the Packaging Machine

This section explains how to install the software to be used by the Platform layer. For PVS this includes the provisioning service and/or connection broker software that your Layered Images need to run in the target environment.

Note: If Hyper-V is not the hypervisor where the App Layering appliance is installed, it makes sense to configure Hyper-V settings in this Platform layer.

When installing the software for your environment (see the prerequisites above), keep in mind that the state of the software before you finalize the layer is what the image uses.

To install the software for your environment:

  1. Remote log into the Packaging Machine. Be sure to log in using the User account you used to create the OS.

  2. Install the tools that your Layered Images need to run in your environment. This includes any hypervisor, provisioning service, and connection broker software that you're using, along with any drivers, boot-level applications, and files needed.

    If some of the installation requires a system restart, restart it manually. The Packaging Machine does not restart automatically.

  3. Make sure the Packaging Machine is in the state you want it to be in when the image is booted:

    • If the tools you install require any post-installation setup or registration, complete those steps now.
    • Remove any settings, configurations, files, mapped drives, or applications that you do not want to include on the Packaging Machine.

Next, you need to shut down the Packaging Machine and verify that the Platform Layer is ready to finalize.

Verify the Layer and shut down the Packaging Machine

Once the tools are installed on the Packaging Machine, the next step is to verify that the layer is ready to finalize. At this point, any required post-installation processing needs to be completed. For example, a reboot may be required, or a Microsoft NGen process may need to complete.

To verify that any outstanding processes are complete, you can run the Shutdown For Finalize tool (icon below), which appears on the Packaging Machine's desktop.

To shut down the Packaging Machine so you can finalize the layer

  1. If you are not logged into the Packaging Machine, remote login as the user who created the machine.
  2. Double-click the Shutdown For Finalize icon. A command line window displays messages detailing the layer verification process.
  3. If there is an outstanding operation that must be completed before the Layer can be finalized, you are prompted to complete the process. For example, if a Microsoft NGen operation needs to complete, you may be able to expedite the NGen operation, as detailed below.
  4. Once any pending operations are complete, double-click the Shutdown For Finalize icon again. This shuts down the Packaging Machine.

The Layer is now ready to finalize.

Layer integrity messages you may see during the finalization process

Layer integrity messages let you know what queued tasks must be completed before a Layer is finalized.

The new Layer or Version can only be finalized when the following conditions have been addressed:

  • A reboot is pending to update drivers on the boot disk - please check and reboot the Packaging Machine.
  • A post-installation reboot is pending - please check and reboot the Packaging Machine.
  • An MSI install operation is in progress - please check the Packaging Machine.
  • A Microsoft NGen operation is in progress in the background.

Note: If a Microsoft NGen operation is in progress, you may be able to expedite it, as described in the next section.

Expediting a Microsoft NGen operation

NGen is the Microsoft Native Image Generator. It is part of the .NET system, and basically re-compiles .NET byte code into native images and constructs the registry entries to manage them. Windows will decide when to run NGen, based on what is being installed and what Windows detects in the configuration. When NGen is running, you must let it complete. An interrupted NGen operation can leave you with non-functioning .NET assemblies or other problems in the .NET system.

You have the choice of waiting for the NGen to complete in the background, or you can force the NGen to the foreground. You can also check the status of the NGen operation, as described below. However, every time you check the queue status, you are creating foreground activity, which might cause the background processing to temporarily pause.

Forcing the NGen to the foreground will allow you to view the progress and once the output has completed, you should be able to finalize the layer.

  1. Force an NGen operation to the foreground.

    Normally, NGen is a background operation and will pause if there is foreground activity. Bringing the task into the foreground can help the task to complete as quickly as possible. To do this:

    1. Open a command prompt as Administrator.

    2. Go to the Microsoft .NET Framework directory for the version currently in use:

      cd C:\Windows\Microsoft.NET\FrameworkNN\vX.X.XXXXX

    3. Enter the NGen command to execute the queued items:

      ngen update /force

      This brings the NGen task to the foreground in the command prompt, and lists the assemblies being compiled.

      Note: It’s okay if you see several compilation failed messages!

    4. Look in the Task Manager to see if an instance of MSCORSVW.EXE is running. If it is, you must allow it to complete, or re-run ngen update /force. Do not reboot to stop the task. You must allow it to complete.
  2. Check the status of an NGen operation

    1. Open a command prompt as Administrator.

    2. Check status by running this command:

      ngen queue status

    3. When you receive the following status, the NGen is complete, and you can finalize the Layer.

      The .NET Runtime Optimization Service is stopped.

Finalize the Layer

Once the software is installed and ready to finalize, and you have shut down the virtual machine, you'll need to finalize the Layer.

Note: When you finalize a Layer, the App Layering software may delete the Packaging Machine so as not to incur extra cost for storage.

When the Layer has been verified and is ready to finalize:

  1. Return to the App Layering Management Console.
  2. Select Layers >App Layers, and then the layer you just prepared.
  3. Select Finalize in the Action bar.
  4. Monitor the Task bar to verify that the action completes successfully and that the Layer is ready to deploy.