During my time with Citrix Consulting, I have supported many large customers with VDI environments hosting anywhere from 5,000 to 100,000 desktops. These large environments require us to pay special attention to reducing management overhead and also mitigating performance bottlenecks, such as extended GPO application times, which might negatively impact the user experience. Many of my customers needed to solve the same problems so I decided to write a Windows service to make their resolution simple to implement.
There are many ways to provide the features outlined in this post, but a Windows Service proved to be the most reliable and straightforward to implement.
The Citrix Desktop Helper Service is configured with registry settings and provides the following capabilities:
Shutdown Inactive Desktops
I have supported customers PVS streaming thousands of virtual desktops and one of their biggest time sinks is rebooting machines after a disk update. One of the major benefits of non-persistent desktops is knowing all of your users are connected to identical desktops. To that end, some customers reboot their PVS streamed targets immediately after assigning a new disk so that users get the latest updates. One of my customers spent hours rebooting desktops and that prompted me to add the shutdown inactive desktops capability to this service.
By default, Citrix XenDesktop only automatically shuts down a desktop after a user logs off the desktop or when power management determines it needs to lower available capacity. As a result, virtual desktops might remain powered on for an indefinite amount of time.
The “Shutdown Inactive Desktops” feature allows Citrix administrators to enable a timer that shuts down a virtual desktop after it has been registered for a configured amount of minutes without a user connection. Administrators can combine this feature with XenDesktop’s power management capabilities to automatically replace powered on PVS targets streaming the old disk with targets streaming the new disk. For example, set this value to 240 and the desktop helper service will initiate a shutdown after the machine has been online for four hours without a connection. If you deploy a new PVS gold disk at 6:00pm then you can rest assured that all the virtual desktops with the old PVS disk will shutdown by 10pm and those machines will have the new disk the next time they power up.
Delay Citrix Desktop Service Start
Some of our largest enterprise, and government, customers have a significant number of Microsoft group policies that must be applied to machines at start up. Windows services and applications, including the VDA and other third party software, do not wait for group policy processing to complete before they start. As a result, the VDA might attempt to register with a controller before the machine is finished performing other tasks such as updating antivirus, pre-fetching streaming app data, etc. This leads to poor experience, as users may be brokered to a desktop that may not be prepared to accept a user session.
Delaying the Citrix Desktop Service start by a configurable amount of time allows the desktop to finish performing on-boot tasks before a user is brokered to it.
Force Group Policy Update
The “Force Group Policy Update” feature was added to address PVS streamed devices becoming unavailable after Daylight Savings Time. This issue has been mostly mitigated since PVS 7.1.3, but many customers find forcing a group policy update shortly after boot up solves various other issues related to group policy application failure. It also serves as an extra safeguard during daylight savings time.
This setting in the Citrix Desktop Helper Service give administrators the ability to force a group policy update after a configured amount of time.
Citrix Consulting has found the time change issue still affects some PVS environments and it is usually the result of various environment conditions. As a recommended practice, we recommend our customers configure PVS target devices to match the time of their hypervisor. Additionally, the hypervisor’s time must be in sync with the domain.
The GPO application failure issue can arise because on boot up Windows machines process group policies before the time is updated. As a result, Kerberos authentication to the domain fails and group policy processing is delayed (by default) 90 minutes if the machines time is out of sync with the domain. During this time, virtual desktops that receive their list of Delivery Controllers through GPO will fail to register, will reboot, and be placed in maintenance mode after three failed registration attempts (this is all by design). Even if you push the list of Delivery Controllers through other methods, many others issues can arise from the lack of GPO processing.
Again, there are several means to solve this problem such as ensuring the hypervisor’s time is in sync with the domain and that your VMs receive time from their host.
Delay Desktop Shutdown
Some of our customers upload quite a bit of user data at logoff. We typically recommend our customers reduce the amount data synced at logoff by taking advantage of Citrix Profile Management, Citrix Workspace Environment Manger, or other means; but sometimes those optimizations are not possible. As a result, the VDA will occasionally shut down a machine before all the data is synced and the failed file sync can cause data loss and/or user profile corruption.
Citrix administrators can mitigate this issue by configuring the “SettlementPeriodBeforeAutoShutdown” property via the Set-BrokerDesktopGroup PowerShell cmdlet.
The “Delay Desktop Shutdown” feature in the Citrix Desktop Helper Service will also delay a machine from shutting down after logoff, but I recommend you stick with the adjusting the “SettlementPeriodBeforeAutoShutdown” property. The “Delay Desktop Shutdown” feature was incorporated into the Desktop Helper service before that property was added in XenDesktop 7.6.
Gotchas, Disclaimers, and other info…
- This Windows service is provided as a free tool/utility add-on to your Citrix XenDesktop or XenApp deployment. It is not an officially supported Citrix product. If you have issues with this add-on, you cannot open a ticket with Citrix Tech support. Citrix is not responsible or liable for the use of this utility. Please use it in a test environment first!
- The VDA must be installed first.
- Microsoft .NET Framework 4 is required.
- The service has only been tested with Windows 7 and Windows 10.
I hope you find this tool helpful. Please use caution when you deploy this tool and keep in mind it is not officially supported by Citrix.