Configure Windows 10 for Citrix PVS with Citrix App Layering.

More from the Lab!

 

We discussed in the previous posts of this Citrix App Layering series how to install and configure the appliance. We also reviewed how to work with OS, Platform, Application and User layers in App Layering and how to deliver them elastically. In this post, we will review more in details Windows 10 and PVS with Citrix App Layering.

More from this Citrix App Layering series

Requirements

For this lab, you need the following:

Best Practices for Windows 10 & PVS in Citrix App Layering

  • Legacy Network Adapter (Hyper-V) or VMXnet3 (VMware)
  • Install VDA with Run As an Administrator or it will fail to install requirements.
  • Then PVS Target Device client in the Platform layer.
  • Attach the Write Cache disk from the PVS template in the Platform layer. Install the disk in the layer and then detach the disk from the Platform layer virtual machine before finalizing.
  • Run JGPIERS Windows 10 Optimization Script: JGSpiers-W10-1803-Optimisations.
  • Disable IPV6.
  • Configure Service Account credentials in the PVS Connector configuration

Configure Windows 10 & PVS in Citrix App Layering

Install Citrix App Layering agent on a server part of the PVS farm

The App Layering agent is required to publish Layered Images to PVS. You must install the agent before creating the Connector for PVS.

Open the ELM package downloaded from Citrix website.

ELM package
ELM package

You should have citrix_app_layering_agent_installer.exe in it.

Install the agent on a PVS server that is part of the PVS famr and needs to communicate with ELM.
See below the process to install the agent.

Install Citrix App Layering Agent - Step 01
Install Citrix App Layering Agent – Step 01

Accept license agreement.

Install Citrix App Layering Agent - Step 02: license agreement
Install Citrix App Layering Agent – Step 02: license agreement

Enter agent port (default 8016).

Install Citrix App Layering Agent - Step 3: Port configuration
Install Citrix App Layering Agent – Step 3: Port configuration

Click on install.

Install Citrix App Layering Agent - Step 04: install
Install Citrix App Layering Agent – Step 04: install

To register the agent in ELM, you need to specify the ELM server IP and credentials.

Install Citrix App Layering Agent - Step 05: registration
Install Citrix App Layering Agent – Step 05: registration

If you do not register the agent during installation, you can manually register it later. However, remember that the PowerShell scripts do not run until the agent is registered with the appliance. See Manual registration.

Click on Register.

Install Citrix App Layering Agent - Step 06: completion
Install Citrix App Layering Agent – Step 06: completion

The installation is completed.

Configure Citrix PVS connector in App Layering

Adding a connector for PVS will allow you to publish directly from the ELM console to PVS. The disk will be automatically added into the PVS store and configured. However you will still have to manually assign it the devices. Also if you have multiple PVS servers and no central repository, you will need to manage the synchronization of your vDisks between your servers (PowerShell, DFS-R, etc).

See Citrix Documentation for connectors.

Go to System > Connectors > Add Connector Config.

Add PVS Connector in App Layering
Add PVS Connector in App Layering

Select the connector that applies to your configuration (Ex: Citrix PVS).

Add PVS Connector in App Layering - Select Connector
Add PVS Connector in App Layering – Select Connector

This will open a new page with the connector wizard.

First step is to add a new name for the connector.

Add PVS Connector in App Layering - Name connector
Add PVS Connector in App Layering – Name connector

Then let’s move to the PVS connector configuration.

 

You should be able to find the PVS server where you installed the agent earlier.

Add PVS Connector in App Layering - Connector configuration
Add PVS Connector in App Layering – Connector configuration

Add the proper credentials and click on Check Credentials to validate them

Note: you may need to register PVS PowerShell snapin on the server again. See https://support.citrix.com/article/CTX235079

Add PVS Connector in App Layering - vDisk settings
Add PVS Connector in App Layering – vDisk settings

Next, configure vDisk settings.  Select the PVS site and the PVS Store name in the dropdown list. Then You need to set the default configuration for the write cache, the size of the write cache and the type of license mode. You can also Enable AD machine account password management, load balancing and printer management if needed.

Add PVS Connector in App Layering - Configuration
Add PVS Connector in App Layering – Configuration

Make sure to click on Test to validate that the PVS connector is configured properly.

Then click on Save and close the window.

Add PVS Connector in App Layering - Save Configuration
Add PVS Connector in App Layering – Save Configuration

In ELM, you should see the new PVS connector.

Add PVS Connector in App Layering - New connector created
Add PVS Connector in App Layering – New connector created

Create PVS client virtual machine

We need to create a virtual machine that we will use for PVS. We only need to configure a disk for the write cache.

Note: Make sure to use the Legacy Network Adapter. 

Here is the PowerShell code to create the PVS Client virtual machine for Microsoft Hyper-V:

Leave this virtual machine OFF for now. We will use it later to boot our PVS image.

Create Windows 10 Master Image

Let’s create a new Windows 10 virtual machine in Hyper-V with PowerShell.

The virtual machine will automatically boot.

Windows 10 boot screen
Windows 10 boot screen

From here install Windows 10 as usual.

Once Windows 10 installed, make sure to follow OS Layer best practices:

  • Have one OS layer per Operating System (Windows Server 2016, Windows 10 64-bit, etc)
  • Check Citrix documentation about supported OS
  • The Operating System layer is always the lowest priority layer. It is always at the bottom of the layer stack no matter what the version date and time is.
  • Start with a fresh image of a supported Windows OS from your hypervisor. Create a new base image based on latest .ISO downloaded from Microsoft website that includes latest Windows updates (Ex: Windows Server 2016 ISO download)
  • Legacy NIC for Hyper-V and VMXNET3 for VMware
  • Generation 2 virtual machine type is not supported with Hyper-V. Only Generation 1.
  • Configure DHCP to get an IP address in the template.
  • Clean up any installers or temp directories.
  • OS Layer must be as clean as possible. Only install required apps! And only install on C:\ drive.
  • If needed, install RDSH and Remote Assistance. If 2012 (R2), also install Desktop Experience.
  • Activate WindowsWindows is Activated
  • Rename the machine and leave it in WORKGROUP
  • Install pending Windows Updates and then stop and disable Windows Updates service and then REBOOT!
  • Install Microsoft .NET Framework and Visual C++ libraries in the OS layer
  • Install Microsoft .NET Core in the OS LayerEnable .NET Framework Core
  • Remove all Microsoft Store Apps and Disable related services
  • Disable Windows Defender and Windows Firewall
    Set-NetFirewallProfile -Profile Domain, Public, Private -Enabled False
    Set-Service MpsSvc -StartUpType Disabled
    Stop-Service MpsSvc -force
  • Disable IPV6 (PVS only)
     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\
    Name:             DisabledComponents
    Type:             REG_DWORD
    Min Value:        0x00
    Max Value:        0xFF (IPv6 disabled)
  • Disable IE ESC
  • Force High Performance Power Scheme
    Powercfg /list
    Powercfg /s {UID}
  • Configure Page File
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
    Key: "PagingFiles" (reg_multi_sz)
    Value: "C:\pagefile.sys 4096 4096"
  • Set Time to display list of OS to 5s
    Bcdedit /timeout 5
  • Adjust performance for programs
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PriorityControl
    Key: "Win32PriortySeparation" (dword)
    Value: "26"
  • Remove Legal notice
    (Remove. Causing delay in launching published applications)
    HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System;
    Legalnoticecaption
    Legalnoticetext
  • Run Citrix Optimizer with the appropriate template
    Run Citrix Optimizer with 2016 template
    Run Citrix Optimizer with 2016 template
  • Disable OS Rearm (MCS Only)
    Set-ProvServiceConfigurationData -Name ImageManagementPrep_Excluded_Steps -Value OsRearm
  • Hypervisor tools of your main hypervisor should be installed into the Operating System layer (Ex: VMware Tools or Hyper-V Integration Services). If you plan to deploy that image on a different hypervisor, you will need to add the tools on the platform layer.
  • Do not install applications (Antivirus, Monitoring agents, etc) in the OS Layer.
  • Create new local users and local groups in this layer. Domain users and groups can be added by GPO.
  • Always connect to the OS Layer with the same local account
  • Check this link for more best practices.
  • Run Preparation Script instead of Shutdown For Finalize (optional)

Browse to the Citrix App Layering package.

Double click on citrix_app_layering_os_machine_tools_xx.xx.x.exe.

App Layering package
App Layering package

This package will unzip in C:\Windows\Setup\scripts (by default).

App Layering machine tools
App Layering machine tools

If not started automatically, run SetKMSVersion.hta.

Set KMS in App Layering
Set KMS in App Layering

Run also RemoveStoreApp.cmd to remove all Microsoft Store applications from the image.

Remove Microsoft Store apps
Remove Microsoft Store apps

Then run setup_x64.exe to install Citrix App Layering Image Preparation Utility.

Install Citrix App Layering Image Preparation Utility
Install Citrix App Layering Image Preparation Utility

Select Next to install.

Install Citrix App Layering Image Preparation Utility - Wizard
Install Citrix App Layering Image Preparation Utility – Wizard

Select Next.

Install Citrix App Layering Image Preparation Utility - Answer file
Install Citrix App Layering Image Preparation Utility – Answer file

Then Finish to close the window.

Install Citrix App Layering Image Preparation Utility - Completed
Install Citrix App Layering Image Preparation Utility – Completed

Shutdown the virtual machine.

Create OS Layer for Windows 10 in Citrix App Layering

Go to ELM console > Layers > OS Layers and select Create OS Layer.

Create OS Layer
Create OS Layer

Enter layer details:

Create OS Layer - Windows 10 - Layer Details
Create OS Layer – Windows 10 – Layer Details

Select the connector to be able to browse the virtual machines.

Create OS Layer - Windows 10 - Connector
Create OS Layer – Windows 10 – Connector

Select the virtual machine previously created.

Create OS Layer - Windows 10 - OS Disk Details
Create OS Layer – Windows 10 – OS Disk Details

Select icon assignment.

Create OS Layer - Windows 10 - Icon assignment
Create OS Layer – Windows 10 – Icon assignment

Confirm.

Create OS Layer - Windows 10 - Confirm
Create OS Layer – Windows 10 – Confirm

ELM will start to import the virtual machine in the repository.

Create Platform Layer for Windows 10 in Citrix App Layering

Make sure to follow Platform Layer best practices:

  • Platform Layer has the highest priority of all layers. This layer will be applied last.
  • Install Citrix Virtual Desktop Agent (VDA), Receiver/Workspace App, Real-Time Optimization Pack (RTOP), WEM and PVS Target Device software in the Platform Layer
  • Do not install Windows Updates in this layer
  • Join the machine to the domain
  • Logon with a domain account to cache data in the layer. This will improve logon time.
  • The Platform layer has the highest priority when creating the layered image.  This means it is applied last so its settings will override all other layers.
  • Single Sign-on applications must be installed in this layer (Ex: Imprivata)
  • Video drivers (nVidia, AMD) can be installed in this layer
  • Do not disable iPV6 (for PVS). Do it in the OS Layer.
  • Changes made to local users and groups are not saved in this layer. Use GPOs instead.
  • You can add additional disks but you must remove them before finalizing the disk in the ELM console
  • If you want to deploy this image on a different hypervisor, install the hypervisor tools in this layer.
  • Check this link for more best practices
  • To have a Write Cache disk with PVS, you must attach the same disk to the Platform Layer. Install it in the layer. Then shutdown the layer and remove the disk before finalizing (See CTX232126).
  • Run Citrix Optimizer to apply Citrix optimizations. Windows optimizations were applied in the OS layer in the previous post.

Go to ELM console > Layers > Platform Layer and select Create Platform Layer.

Create Platform Layer
Create Platform Layer

Click on Create Platform Layer.

Enter layer details:

Create Platform Layer - Windows 10 - Layer details
Create Platform Layer – Windows 10 – Layer details

Select the OS Layer.

Create Platform Layer - Windows 10 - OS Layer
Create Platform Layer – Windows 10 – OS Layer

Select the connector to be able to browse the virtual machines.

Create Platform Layer - Windows 10 - Connector
Create Platform Layer – Windows 10 – Connector

Select Platform types.

Create Platform Layer - Windows 10 - Platform Types
Create Platform Layer – Windows 10 – Platform Types

Enter a disk filename.

Create Platform Layer - Windows 10 - Packaging Disk
Create Platform Layer – Windows 10 – Packaging Disk

Assign an icon.

Create Platform Layer - Windows 10 - Icon Assignment
Create Platform Layer – Windows 10 – Icon Assignment

Select Create Layer to confirm.

Create Platform Layer - Windows 10 - Confirm
Create Platform Layer – Windows 10 – Confirm

Connect to the virtual machine create during the Platform Layer process.

Add the virtual machine to the domain. Reboot and then logon with a domain account to cache domain information in the layer.

Create Platform Layer - Add to domain
Create Platform Layer – Add to domain

Note: move the computer object in the correct OU. 

Install Citrix Virtual Desktop Agent, Citrix Receiver/Workspace app and then PVS Target Device (if needed).

Create Platform Layer - Install VDA
Create Platform Layer – Install VDA

Note: Make sure you have installed Microsoft Visual C++ libraries in the OS Layer or VDA will install them in the Platform Layer. 

Install Citrix PVS Target Device in the layer.

Create Platform Layer - Install PVS Target Device software
Create Platform Layer – Install PVS Target Device software

Reboot the virtual machine.

Take a look at the Local groups.

Create Platform Layer - Local Groups
Create Platform Layer – Local Groups

Citrix VDA install created the following local groups:

  • Direct Access Users
  • Anonymous

And added users in few others:

  • NT Service\CitrixTelemetryService in Performance Log Users
  • NT Service\BrokerAgent in Performance Monitor Users

This configuration will not be captured in the layer. You need to create a domain GPO to applies the configuration.

Additionally you can also add few others:

  • NT AUTHORITY\Authenticated Users in Remote Desktop Users
  • <DOMAIN>\<CITRIX_ADMIN_GROUP> in Administrators
  • <DOMAIN>\<CITRIX_DA_USERS> in Direct Access Users

Note: NT Service accounts can only be added via Group Policy Preferences

See below an example of implementation via GPO.

Create Platform Layer - GPO for local group configuration
Create Platform Layer – GPO for local group configuration

Next step is to add the Write Cache disk in the Platform Layer. By default, the virtual machine created by ELM for the Platform layer has 2 disks mapped.

Create Platform Layer - Disks
Create Platform Layer – Disks

Here is to PowerShell script to attach the disk from the PVS virtual machine created earlier in this article.

Note: you can also import that disk manually in the configuration of the virtual machine.

The disk is now attached to the virtual machine via the SCSI Controller.

Create Platform Layer - Disks - Write Cache disk attached
Create Platform Layer – Disks – Write Cache disk attached

In the virtual machine, open diskmgmt.msc. The tool will automatically start to scan for new disks.

You can also manually Recan Disks in the Action menu.

Create Platform Layer - Disks - Scan Disks
Create Platform Layer – Disks – Scan Disks

Select MBR (Master Boot Record).

Create Platform Layer - Disks - Initialize Disk
Create Platform Layer – Disks – Initialize Disk

Click OK. The new disk should appear Unallocated.

Create Platform Layer - Disks - Disk Initialized but not allocated
Create Platform Layer – Disks – Disk Initialized but not allocated

Right click the unallocated disk and select New Simple Volume.

Create Platform Layer - Disks - Create new volume
Create Platform Layer – Disks – Create new volume

Click next.

Create Platform Layer - Disks - Volume Size
Create Platform Layer – Disks – Volume Size

Assign a drive letter.

Create Platform Layer - Disks - Assign Letter
Create Platform Layer – Disks – Assign Letter

And assign a name for the volume.

Create Platform Layer - Disks - Assign name to volume
Create Platform Layer – Disks – Assign name to volume

Click Finish to confirm.

Create Platform Layer - Disks - Finish
Create Platform Layer – Disks – Finish

Windows will partition the Write Cache disk.

Create Platform Layer - Disks - Write Cache Added
Create Platform Layer – Disks – Write Cache Added

Reboot the virtual machine.

Run Citrix Optimizer with the appropriate Windows 10 template.

Run Citrix Optimizer with 2016 template
Run Citrix Optimizer with 2016 template

Once you are done with the optimizations, click on Shutdown For Finalize.

Before Finalizing, remove the disk from the virtual machine.

Make sure that the disk was removed properly. ELM will not be able to finalize the layer if the disk is present.

Create Platform Layer - Disks - Write Cache Removed
Create Platform Layer – Disks – Write Cache Removed

Finalize the Platform Layer in ELM.

Publish Layered Image of Windows 10 in Citrix App Layering

Go the the ELM console > Images and select Create Template.

App Layering Image Deployment - Template - Create a new template
App Layering Image Deployment – Template – Create a new template

In the Template Wizard, enter the name of the template and pick an icon.

App Layering Image Deployment - Template - Create a new template - Name and Description
App Layering Image Deployment – Template – Create a new template – Name and Description

Select the OS Layer to be integrated in this image.

App Layering Image Deployment - Template - Create a new template - OS Layer
App Layering Image Deployment – Template – Create a new template – OS Layer

No assignment.

App Layering Image Deployment - Template - Create a new template - Application Assignment
App Layering Image Deployment – Template – Create a new template – Application Assignment

Select the connector.

App Layering Image Deployment - Template - Create a new template - Connector
App Layering Image Deployment – Template – Create a new template – Connector

Select the Platform Layer.

App Layering Image Deployment - Template - Create a new template - Platform Layer
App Layering Image Deployment – Template – Create a new template – Platform Layer

Add Layered Image Disk settings.

App Layering Image Deployment - Template - Create a new template - Layered Image Disk
App Layering Image Deployment – Template – Create a new template – Layered Image Disk

Select Create Template and Publish.

Note: Create Template does not deploy the image to the target infrastructure. 

App Layering Image Deployment - Template - Create a new template - Confirm
App Layering Image Deployment – Template – Create a new template – Confirm

ELM will start to create the template and deploy it the the PVS server configured in the connector.

Configure PVS for Windows 10 in Citrix App Layering

Go the the PVS console > Stores.

The new Layered Image was deployed and automatically added in the Store defined in the PVS Connector.

App Layering - PVS - Disk published
App Layering – PVS – Disk published

Go the the PVS console > Sites > DEV > Device Collections and create a new collection for Windows 10.

App Layering - PVS - Create a new collection
App Layering – PVS – Create a new collection

 

Create a new Target Device in this collection.

App Layering - PVS - Create Target Device
App Layering – PVS – Create Target Device

Make sure that the Target Device has the same MAC address than the virtual machine created (Ex: 00-00-00-00-00-01).

App Layering - PVS - MAC address
App Layering – PVS – MAC address

Then assign the vDisk previously created and published via the ELM console.

App Layering - PVS - Assign Disk
App Layering – PVS – Assign Disk

Click OK to create the Device.

Note: In this lab, we are using a Boot Device Manager (BDM) .ISO disk for the boot to simplify the process. 

Boot the virtual machine.

The virtual machine is up and running.

You may have BSODs related to the following:

  • SYSTEM_THREAD_EXCEPTION_NOT_HANDLED (CVhdMp.sys) (CTX229910)
    • When using default network adapter instead of Legacy Network Adapter.
  • INACCESSIBLE BOOT DEVICE (CTX232126)
    • The cache disk was not added properly to the Platform Layer.

You can logon to the virtual machine and check that the vDisk is streamed properly from the PVS server:

More from the Lab!