AppVCacher


Features
  • Dynamically Pre-Caches Microsoft App-V Global application packages at startup

  • Dynamically Pre-Caches Microsoft App-V User application packages at startup

  • Logs onto the Virtual Delivery Agent at startup improving logon times for subsequent users

  • Starts the Citrix Desktop Service when startup tasks have completed

  • Encrypts the user password in the registry using an RSA key

  • Removes the need to pre-cache App-V packages in you master images

System Requirements

  • Windows 2016, Windows 2019, Windows 10

  • Microsoft PowerShell 3.0

  • Microsoft .Net Framework 4.6.1

  • Citrix Virtual Apps and Desktops (Service) - Formerly XenApp & XenDesktop

  • Microsoft App-V Infrastructure (Dual-Admin Mode)

AppVCacher is a command line utility that enables Microsoft App-V packages to be pre-cached to non-persistent Citrix Virtual Delivery Agents at system startup, reducing application launch time for users.

Additionally AppVCacher can perform an RDP logon at system startup to 'warm up' the VDA, reducing logon times for users.

AppVCacher is configured in the master image using the /config switch.

AppVCacher is invoked at system startup by a Group Policy startup script using the /launch switch.

AppVCacher may be invoked using a Scheduled Task (running as System) however a startup script is the recommended method as it can be easily enabled, disabled or parameters may be dynamically modified.

User logon without VDI Warmup - Windows 10 LTSC Build 1809

User Logon with VDI Warmup - Interactive Session time is reduced by 50%

Configuration

Configure and Test AppVCacher in a Test environment before deploying in Production.

 

Download AppVCacher.zip and extract to C:\Program Files\AppVCacher on you master image

Open an elevated command prompt and run

"C:\Program Files\AppVCacher\AppVCacher.exe" /config

Configure parameters according to the instructions below.

 

All parameters are stored in the registry under

HKEY_LOCAL_MACHINE\SOFTWARE\Chawn\AppVCacher\Settings

 

Setting Registry
UserName User

Instructions:

Enter the name of the Active Directory User Account

Pre-Requisites:

Create an Active Directory user account for the service user.

The password for the user account must be set to 'Never Expire'

The password must comply with the current Active Directory Password policy. Uppercase, Lowercase, Length, Special characters etc

'Change password at next logon' must not be enabled.

If AppVCacher will be used to synchronise Microsoft App-V user packages, the user must be a member of all user assigned App-V application Active Directory groups

Setting Registry
Password sPWD

Instructions:

Enter the password for the Active Directory User Account

A new RSA key is generated every time AppVCacher is run in config mode. The RSA key is used to encrypt the user's password in the registry.

Pre-Requisites:

The password must comply with the current Active Directory Password policy. Uppercase, Lowercase, Length, Special characters etc

Setting Registry
Domain Domain

Instructions:

Enter the name of the user's Active Directory domain in NETBIOS format

Pre-Requisites:

Virtual Delivery Agents are members of the Domain or members of a trusting domain

Setting Registry
Add User to Administrators AddAdmin  ----- [True | False]

Instructions:

Enable or Disable (Disable recommended)

Explanation:

The user performing the synchronisation of App-V user packages need NOT be a member of Administrators however if security settings prevent the user account from synchronising App-V user packages then the user may be added to Administrators before performing the synchronisation

Setting Registry
Remove User from Administrators RemAdmin  ----- [True | False]

Instructions:

Enable or Disable (Disable recommended)

Explanation:

If 'Add User to Administrators' is selected then the user can be removed from Administrators after performing the synchronisation

Setting Registry
Delete User Credentials on exit DelCred  ----- [True | False]

Instructions:

Enable or Disable

Explanation:

If selected, the encrypted password is deleted from the registry before AppVCacher exits (Paranoid mode)

Setting Registry
SyncAppVPublishingServer (User) SyncAppVu  ----- [True | False]

Instructions:

Enable to perform an App-V User package Synchronisation at startup

Pre-Requisites:

The user must be a member of all user assigned App-V application Active Directory groups

Setting Registry
SyncAppVPublishingServer (Global) SyncAppVg  ----- [True | False]

Instructions:

Enable to perform an App-V Global package Synchronisation at startup

Pre-Requisites:

Virtual Delivery Agents' Active Directory computer accounts must be members of Active Directory groups that assign globally published App-V packages

Setting Registry
App-V Publishing Server URL AppVurl

Instructions:

Enter the FQDN of your Microsoft App-V Publishing server or load balancer, including the port number with an http(s):// prefix

e.g. http://appv.domain.local:54321

Explanation:

If a Microsoft Group Policy Object is used to configure the App-V Publishing Server URL, then this setting is not required

If a Citrix Studio Policy Object is used to configure the App-V Publishing Server URL, then this setting will not be available until the Citrix Desktop Service has started therefore you need to specify the URL to enable a successful App-V global or user synchronisation

Setting Registry
VDI Warmup - Perform RDP Logon RDPLogon  ----- [True | False]

Instructions:

Enable to perform an RDP Logon at Startup

Pre-Requisites:

Username and Password have been configured

Start Broker Service is enabled

Explanation:

AppVCacher will create a local user account, add the user to the Administrators Group and perform an RDP Logon. The session will logoff after 20 seconds by default. The local user account is deleted after logoff.

The Broker Service must be disabled when this event occurs, otherwise the VDA will reboot following the logoff if using a single user operating system (Windows 10)

Setting Registry
VDI Warmup - Use Domain account RDPDomain  ----- [True | False]

Instructions:

Enable to perform an RDP Logon at Startup using domain user credentials (not a local user)

Pre-Requisites:

Username and Password have been configured

Start Broker Service is enabled

Explanation:

AppVCacher will add the domain user account to the Administrators Group and perform an RDP Logon. The session will logoff after 20 seconds by default. The domain user account is removed from the Administrators Group after logoff.

The Broker Service must be disabled when this event occurs, otherwise the VDA will reboot following the logoff if using a single user operating system (Windows 10)

Setting Registry
RDP Timeout (ms) RDPTimeoutInMS

Instructions:

Specify a value in milliseconds before the RDP session is logged off (Default 20000)

Explanation:

By default, the RDP Session will be logged off after 20 seconds. Specify a suitable amount of time based on your environment and the performance of the VDAs before logging off the RDP Session. A domain user logon may require more time while Group Policy Objects are applied, logon scripts are executed and startup processes are launched.

Setting Registry
Start Broker Service StartBroker  ----- [True | False]

Instructions:

Select to disable the 'Citrix Desktop Service' and start the 'Citrix Desktop Service' when all AppVCacher tasks have completed

Enabled (Recommended)

Pre-Requisites:

By default the 'Citrix Desktop Service' is configured to start automatically at startup. When the Virtual Delivery Agent registers with a Delivery Controller, the VDA is available for logons. However you do not want logons to occur until all AppVCacher tasks have completed therefore it is recommended that 'Start Broker Service' is selected.

e.g The RDP logon takes 20 seconds by default

e.g Globally caching Microsoft Office can take approximately two minutes

Enable RDP Button

In order to perform an RDP logon, Remote RDP Connections must be Enabled and port 3389 udp / tcp must be Enabled.

RDP is not enabled by default on a XenDesktop (Single User) VDI even after the Citrix Desktop Virtual Desktop Agent has been installed. Ensure that RDP is enabled and that firewall rules are in place.

The Enable RDP button can enable RDP and firewall rules if necessary.

Testing / Validation

Testing should be performed in a non-production Delivery group.

AppVCacher must have been deployed and configured in the Master Image.

It is recommended that AppVCacher is invoked using a computer startup script configured in a Microsoft Group Policy object. The Microsoft Group Policy object must be linked to an Organisational Unit containing the VDAs.

A sample startup script (appvsync.cmd) is included in the zip file.

The startup script simply calls:

"C:\Program Files\AppVCacher\AppVCacher.exe" /launch

You can modify AppVCacher parameters and action in the startup script before it is invoked.

You can invoke AppVCacher with the /launch startup parameter interactively from an elevated command prompt to validate functionality.

A log file is written to C:\Windows\Temp\AppVCacher.txt

 

You can test the RDP Logon functionality using the /tryRDP startup parameter.

When running AppVCacher /tryRDP on a XenApp (multi-user) server, AppVCacher will logon to the XenApp server using RDP, wait according to the RDPTimeoutinMS value before logging off and closing the window.

When testing on a XenDesktop (single user) VDA, the following window is displayed. The RDP Connection window does not accept input however it will disconnect and close when the RDPTimeout is reached.

This is a successful test on a VDI (single user) operating system. It will successfully connect and logon at startup as it will be the only RDP connection.

Below is a log file demonstrating AppvCacher functionality on a Citrix XenApp Server.

Black: Logs variables and actions

Pink: Adds the App-V Publishing Server

Orange: App-V Sync Global - Displays synchronised App-V Global packages - Microsoft Office takes approximately 2 mins to deploy

Red: App-V Sync User as a domain user account - Displays synchronised App-V User packages - 10 seconds to deploy

Blue: Adds the domain user account to local Administrators and performs an RDP Logon

Green: Enables and Starts the 'Citrix Desktop Service' enabling logons to the Virtual Delivery Agent

Date/Time: 07/08/2019 15:11:30 --- Started
Date/Time: 07/08/2019 15:11:30 --- Command Line:/launch
Date/Time: 07/08/2019 15:11:30 --- Launch
Date/Time: 07/08/2019 15:11:30 --- Domain: chawn
Date/Time: 07/08/2019 15:11:30 --- User: svc_appvcache
Date/Time: 07/08/2019 15:11:30 --- Specified AppVurl: http://svr-appv01.chawn.local:54321
Date/Time: 07/08/2019 15:11:30 --- Sync App-V Global: True
Date/Time: 07/08/2019 15:11:30 --- Sync App-V User: True
Date/Time: 07/08/2019 15:11:30 --- Add App-V User to Admins: False
Date/Time: 07/08/2019 15:11:30 --- Remove App-V User from Admins: False
Date/Time: 07/08/2019 15:11:30 --- Delete credentials: False
Date/Time: 07/08/2019 15:11:30 --- Start Citrix Desktop Agent Service: True
Date/Time: 07/08/2019 15:11:30 --- RDP Logon: True
Date/Time: 07/08/2019 15:11:30 --- RDP Domain Logon: True
Date/Time: 07/08/2019 15:11:30 --- RDP Logon timeout in ms: 20000
Date/Time: 07/08/2019 15:11:30 --- Launcher: Attempting to add http://svr-appv01.chawn.local:54321 as AppV Publishing Server
Date/Time: 07/08/2019 15:11:30 --- AddAppVsvr: AppV Publishing Server URL: http://svr-appv01.chawn.local:54321
Date/Time: 07/08/2019 15:11:31 --- AddAppVsvr: Publishing Server = 1:http://svr-appv01.chawn.local:54321
Date/Time: 07/08/2019 15:11:31 --- SyncAppV: Publishing Server = 1:http://svr-appv01.chawn.local:54321

Date/Time: 07/08/2019 15:11:31 --- SyncAppV: Synchronising Global
Date/Time: 07/08/2019 15:13:36 --- SyncAppV: App-V Synchronisation Complete: Global
Date/Time: 07/08/2019 15:13:36 --- AppVPackage: Microsoft Office 2016 O365ProPlusRetail_en-us_x86 PackageUID: eb51a3d4-b87f-4676-ad01-5d583abe053c VersionID: 54be3f3a-93b0-4301-aaef-6f8372c3df99
Date/Time: 07/08/2019 15:13:36 --- App-V Sync Global: Success
Date/Time: 07/08/2019 15:13:36 --- Launcher: Not adding chawn\svc_appvcache to Local Administrators as per configuration
Date/Time: 07/08/2019 15:13:36 --- Decrypt: Got password.

Date/Time: 07/08/2019 15:13:36 --- Launcher: Start Sync AppV Publishing Server - User
Date/Time: 07/08/2019 15:13:45 --- C:\Windows\System32\SyncAppvPublishingServer.exe 1 Exitcode: 0
Date/Time: 07/08/2019 15:13:45 --- AppVPackage: WinMerge PackageUID: 02153d2b-304c-4bcd-8420-06294af5fa7f VersionID: b8b23c78-83cd-4ad6-8996-fc78e5f48bb8
Date/Time: 07/08/2019 15:13:45 --- AppVPackage: WinSCP_5.1.3 PackageUID: 8bb79c30-4ac3-422a-acfa-c1c64637d1c5 VersionID: e00eb1d9-f37f-447c-ae9c-ef2e4ab7468d
Date/Time: 07/08/2019 15:13:45 --- AppVPackage: Adobe-ReaderXI PackageUID: 6ffe0a4a-3aac-40e5-a518-151a7879b78d VersionID: 271ddb64-e202-4f26-9cee-4291f7ec2b10
Date/Time: 07/08/2019 15:13:45 --- AppVPackage: IExplore-JRE16 PackageUID: fe637354-5292-4088-9b04-fdf3b6e9fc76 VersionID: 35bb8805-dd84-4385-9fe7-616e6d0b6736
Date/Time: 07/08/2019 15:13:45 --- Launcher: Not removing chawn\svc_appvcache from Local Administrators as per configuration

Date/Time: 07/08/2019 15:13:45 --- CreateLocalUser: Add user account to Administrators for RDP Logon
Date/Time: 07/08/2019 15:13:45 --- Add Admin: chawn\svc_appvcache successfully added to Administrators
Date/Time: 07/08/2019 15:13:45 --- CreateLocalUser: Successfully added user chawn\svc_appvcache account to Administrators for RDP Logon
Date/Time: 07/08/2019 15:13:45 --- RDPLogon: Attempting RDP Logon to 2016XAW-001 as chawn\svc_appvcache
Date/Time: 07/08/2019 15:13:46 --- RDPConn: Starting RDP Connection for chawn\svc_appvcache
Date/Time: 07/08/2019 15:13:46 --- Decrypt: Got password.
Date/Time: 07/08/2019 15:13:52 --- RDPConn: chawn\svc_appvcache successfully logged on
Date/Time: 07/08/2019 15:14:12 --- RDPConn: Attempting to Log off chawn\svc_appvcache
Date/Time: 07/08/2019 15:14:12 --- RDPConn: Successfully logged off chawn\svc_appvcache Return Code: 2
Date/Time: 07/08/2019 15:14:14 --- RDPLogon: Processing Complete
Date/Time: 07/08/2019 15:14:14 --- Launcher: Attempting to remove chawn\svc_appvcache from Local Administrators
Date/Time: 07/08/2019 15:14:14 --- RemoveAdmin: Successfully removed chawn\svc_appvcache from Local Administrators
Date/Time: 07/08/2019 15:14:14 --- Launcher: chawn\svc_appvcache Administrator removed successfully

Date/Time: 07/08/2019 15:14:14 --- Set BrokerAgent service to Automatic Startup
Date/Time: 07/08/2019 15:14:14 --- BrokerAgent Service set to Automatic Startup
Date/Time: 07/08/2019 15:14:14 --- The Citrix Desktop Controller Service is currently Stopped
Date/Time: 07/08/2019 15:14:14 --- Starting the Citrix Desktop Controller Service
Date/Time: 07/08/2019 15:14:19 --- The Citrix Desktop Controller Service is currently Running
Date/Time: 07/08/2019 15:14:19 --- Broker Service Started

Potential Issues

According to CTX140522, The default maximum time allowed for a VM to register after being switched on or resumed for a session launch is 2 minutes.

Therefore if you set the RDPTimeoutInMS beyond two minutes, you may need to modify the registry on Delivery Controllers / Cloud Connectors as described in the article to cater for the increased time bewteen VDA startup and registration.

 

Further Optimisations

If performing a domain logon using RDPLogon, consider adding a logon script to the user AD account to launch frequently used applications. This will pre-cache the applications in memory allowing for faster startup by subsequent users.

Example Logon Script

start explorer
start iexplore
start winword
start excel
start outlook

You may need to configure AutoEndTasks and WaitToKillAppTimeout in your Default User to prevent the RDPLogoff from hanging due to open applications.