Citrix XenApp

Citrix XenApp 7.x VDA Registration State stuck in Initializing and a self healing powershell script to fix it

On XenApp 7.5 servers (and possibly 7.1 and 7.0), you may notice the registration state of the machine is stuck on “Initializing” in Citrix Studio and no one will be able to launch any apps. I’m still investigating if the 7.6 VDA also has this behavior. This is how it looks in Studio:

You can also run the following powershell command:

Add-PSSnapin Citrix.*.Admin.V*

Advertisement. Scroll to continue reading.

followed by:

Get-BrokerMachine | select MachineName, SummaryState, MachineInternalState, RegistrationState

which results in:

Advertisement. Scroll to continue reading.

You will notice the impacted server in question has a MachineInternalState set to “Unavailable” and the RegistrationState is stuck on “Initializing”. We’ve noticed this happening on XenApp servers that have been up around the 24 or 25 day mark. They suddenly stop being registered.

The work around is to restart the “Citrix Desktop Service” on the impacted server. The service is not in a Stopped state so it’s hard to setup monitoring using a 3rd party monitoring tool. I just wrote this PowerShell script that queries the delivery controller for the actual state of registration on every XenApp server to see if it’s stuck Initializing, restart the Citrix Desktop Service on the impacted servers, log a .csv file with the names of the impacted servers for historical purposes, and send an email notification out to the Citrix admins and NOC. I have this running as a scheduled task (stacked a few min apart) every 5 minutes on all my delivery controllers:

Advertisement. Scroll to continue reading.

If the code runs off the page above you can highlight all of it and paste to Notepad or download it here in text format (make sure you right click – save as). Just change the extension to .ps1 and set your path for the CSV files, SMTP server, and email addresses you want notifications to go to:

XA_Restart_VDA_Notify.txt

Anyhow, you will get a nice notification email like this when servers get stuck. In this example I had 2 servers that were stuck Initializing and by the time the email was received the VDA had already been restarted on both and were Registered again. 🙂

I’m hoping this is fixed in the the 7.6 VDA and am in the process of testing. I really don’t like to have to setup scripts to monitor service health like this but in a pinch, running a self-healing monitoring script is your best bet to prevent an application outage until the issue is resolved. I’m currently monitoring all servers with the 7.6 VDA and will update this post if I see them exhibit the same behavior as the 7.5 VDA.

Advertisement. Scroll to continue reading.

UPDATE:
Just updated the script above to include the agent version. Here’s how your notification email and .csv file will look:

6 Comments

  1. Lal Mohan

    February 12, 2015 at 8:00 PM

    Wouldn’t restarting the Desktop service on the failing server kill all the existing user sessions?

  2. Gizmo

    September 13, 2016 at 9:39 AM

    Furthermore, restarting the service shows in the event log that it successfully connected to the DDC yet the DDC still does not show the targets registered 🙁

  3. Arun

    March 10, 2017 at 1:29 AM

    Hi Jason,

    Recently we migrated XenApp 6.5 to XD 7.9 and we get the same issue reported
    Opened a case with Citrix and will keep posted with the updates on it.

  4. Magnus

    July 6, 2017 at 8:40 AM

    Restarting the desktop service doesn’t kill existing sessions (at least from my testing).
    When seeing the agent in an “initializing” state on a Win7 VDA, typically its an issue with either the video driver, or general connectivity type issue with the DDC or DNS entries not being correct. Restarting the service, in my experience, fixes about 20% of the machines that this issue occurs to.

  5. lschums

    July 18, 2023 at 10:01 AM

    We see this issue with pretty recent 2203 LTSR CU2 VDAs.
    It is nice that there is an easy workaround, but has the underlaying cause ever be found ?
    In our case the initializing state is also not reported in director as an error so you only notice, that there are a less sessions than usual.

  6. lschums

    July 19, 2023 at 1:19 AM

    We see this behaviour with 2203 CU2 VDAs and while being happy, that there is at leasy an workaround without having to reboot workers is is strange to see something like that many years later.
    In our case we observed multiple Kerne-General 1 Messages in System-Log about time adjustment in fractions of seconds (talking about ~0,05s each) and this immediately stops after restarting Citrix Desktop Service and all former sessions are visible again in Director and Studio.

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Apache

Today I would like to go over proper URL redirection when using SSL but first I would like to preface this by describing what...

Exchange 2003

A useful Exchange 2003 guide I wrote for a friend’s blog originally but I am posting it here on mine now for your viewing...

Citrix Workspace

You can use FIDO2 hardware security keys plugged into your physical desktop over the Citrix HDX remoting protocol for use with virtualized Windows Desktop...

Cloud Design Architecture

The community-driven paperback book initiated by my friends Bas van Kaam and Christiaan Brinkhoff is available for sale on Amazon. If you haven’t picked...

JasonSamuel.com was launched in 2008 as a platform to give back to the IT community by sharing knowledge and expertise. Over the years, it has become a trusted global resource for the latest insights, how-to guides, and thought leadership on enterprise mobility, security, virtualization, cloud architecture, automation, and other cutting-edge technologies. Today, it serves as a go-to reference hub for IT professionals, attracting hundreds of thousands of unique visitors from around the world each month. Learn more on the About Me page.
Copyright © 2008-2025 JasonSamuel.com

Exit mobile version