Solved: Citrix Desktop Service Fails to Start, Logs Event 1006

I am sure you all love XenDesktop VDAs that just won’t register. Although this is becoming less and less of a problem I had another case recently.

Checking the Obvious

When a XenDesktop VDA is unregistered the first thing I do is check if the VM is actually turned on. With that out of the way I turn to the application event log, looking for entries with the source Citrix Desktop Service. This usually tells you what the problem is. Not this time, however. Apparently the Citrix Desktop Service (aka WorkstationAgent) ran into some error during startup. It logged the following event with ID 1006 and stopped:

The Citrix Desktop Service failed to start. 
 
If this problem persists, reinstall the Citrix Virtual Desktop Agent. 
See Citrix Knowledge Base article CTX119736
 
Error details: 
Exception 'Invalid value for registry (Exception from HRESULT: 0x80040153 (REGDB_E_INVALIDVALUE))' of type 'System.Runtime.InteropServices.COMException'

Turning on the Log

I read through CTX119736 as recommended that that did not help at all. Then I tried to figure out the error details. Apparently something in the registry was amiss - but what?

Using Citrix’ LogEnabler tool I enabled logging for the WorkstationAgent. I did the same on a machine that registered correctly. Comparing the two logs I found the following error:

[   4] 03/03/14 13:28:24.4109 : Workstation Agent:Binding to AD object with default path: LDAP://CN=COMPUTERNAME,OU=OUNAME,DC=DC=DOMAIN,DC=COM
[   4] 03/03/14 13:28:24.4295 : Workstation Agent:Default binding path failed
System.Runtime.InteropServices.COMException (0x80040153): Invalid value for registry (Exception from HRESULT: 0x80040153 (REGDB_E_INVALIDVALUE))
   at System.DirectoryServices.Interop.UnsafeNativeMethods.IntADsOpenObject(String path, String userName, String password, Int32 flags, Guid& iid, Object& ppObject)
   at System.DirectoryServices.Interop.UnsafeNativeMethods.ADsOpenObject(String path, String userName, String password, Int32 flags, Guid& iid, Object& ppObject)
   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.RefreshCache()
   at Citrix.Cds.ADSupport.ADProvider.BindToObject(String objectDN)

Maybe the registration of the System.DirectoryServices COM object was broken? As MS KB 887438 recommends I checked HKEY_CLASSES_ROOT\TypeLib{97d25db0-0363-11cf-abc4-02608c9e7553} - which was OK. However, I suspected some other problem with registry values and created a Process Monitor trace of the service startup (which did not show anything obviously wrong, like access denied). Filtering the trace so it showed HKCR only I looked at which other keys were accessed after HKEY_CLASSES_ROOT\TypeLib{97d25db0-0363-11cf-abc4-02608c9e7553}. Although there were no obvious problems I took a look at each of them. HKEY_CLASSES_ROOT\AppID{4BC0A672-4AE4-4BE0-91AD-9BCDB1429785} looked suspicious:

Citrix Workerstation Agent App COM Server - empty binary values AccessPermission and LaunchPermission

For those of you not fluent in German: Binärwert der Länge Null means zero-length binary value.

Sure enough, on a working system the binary values AccessPermission and LaunchPermission were not empty! I exported the working machine’s configuration to a reg file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AppID\{4BC0A672-4AE4-4BE0-91AD-9BCDB1429785}]
@="Citrix Workerstation Agent App COM Server"
"LocalService"="WorkstationAgent"
"AccessPermission"=hex:01,00,04,80,44,00,00,00,54,00,00,00,00,00,00,00,14,00,\
  00,00,02,00,30,00,02,00,00,00,00,00,14,00,03,00,00,00,01,01,00,00,00,00,00,\
  05,0b,00,00,00,00,00,14,00,03,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00,\
  01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,01,02,00,00,00,00,00,05,20,\
  00,00,00,20,02,00,00
"LaunchPermission"=hex:01,00,04,80,30,00,00,00,40,00,00,00,00,00,00,00,14,00,\
  00,00,02,00,1c,00,01,00,00,00,00,00,14,00,09,00,00,00,01,01,00,00,00,00,00,\
  05,0b,00,00,00,01,02,00,00,00,00,00,05,20,00,00,00,20,02,00,00,01,02,00,00,\
  00,00,00,05,20,00,00,00,20,02,00,00

Once I had imported that into the faulty machine’s registry the Citrix Desktop Service started correctly and registered without a hitch.

Comments

Related Posts

Shutting Down Unused Persistent XenDesktop VMs

Shutting Down Unused Persistent XenDesktop VMs
When you use XenDesktop the only way it makes sense you may find that Citrix has not really put much effort into making that a smooth experience. Persistent is a Second-Grade Citizen XenDesktop is really designed to be used with pooled desktops - machines that are reset to a pristine state when the user logs off. Of course, stateless desktops are much better (and, importantly, cheaper) served from XenApp. This has been the topic of many a debate which I will not repeat here. But I will state that if you give a so-called knowledge worker a personal desktop, you better make sure that desktop is persistent.
Citrix/Terminal Services/Remote Desktop Services

Latest Posts

Scripted WordPress to Hugo Migration

Scripted WordPress to Hugo Migration
After having published in WordPress for almost 20 years, it was time for a change. This site is now rendered by Hugo, a static website generator built for Markdown content hosted in a Git repository. The migration from WordPress (HTML) to Hugo (Markdown) was far from trivial. Since I couldn’t find any tool for the job, I developed my own set of migration scripts that fully automate the migration process. You can find them on GitHub along with extensive documentation.
Website