Monday, July 8, 2013

SQL tables containing Citrix XenDesktop 5.6 DDC entries

For those who have come across one of my previous posts:

Manually removing orphaned Citrix XenDesktop 5.6 DDC (Desktop Delivery Controller)
http://terenceluk.blogspot.com/2013/03/manually-removing-orphaned-citrix.html

… may know that I’ve encountered an issue where the environment I was working in had an orphaned DDC left in the database that was not removed properly.  What I noticed was that while the script in my previous post appeared to have removed the DDC from Desktop Studio, it continued to show up in Desktop Director’s console.  Furthermore, after installing the update:

Hotfixes Update 4 - For Citrix XenDesktop 5.6 Controller x64 - English
http://support.citrix.com/article/CTX136580

Desktop Studio began prompting me to update the orphaned DDC whenever I opened the Dashboard:

Upgrades for some services are available.

Services can be upgraded on the following controller.

image

Opening up another call with Citrix lead us to running the PowerShell cmdlet to generate the SQL script but the problem with doing so this time was that executing Get-BrokerController no longer displayed the orphaned DDC:

image

… and therefore I was unable to get the required SID variable for the cmdlet:

$db = "CitrixXenDesktopDB"
$sid = "DCC-SID"   
New-Item -ItemType file "$PWD\evict_$sid.txt" -Force
Add-Content "$PWD\evict_$sid.txt" (Get-ConfigDBSchema -DatabaseName $db -ScriptType Evict -SID $sid)
Add-Content "$PWD\evict_$sid.txt" (Get-AcctDBSchema -DatabaseName $db -ScriptType Evict -SID $sid)
Add-Content "$PWD\evict_$sid.txt" (Get-HypDBSchema -DatabaseName $db -ScriptType Evict -SID $sid)
Add-Content "$PWD\evict_$sid.txt" (Get-ProvDBSchema -DatabaseName $db -ScriptType Evict -SID $sid)
Add-Content "$PWD\evict_$sid.txt" (Get-PvsVmDBSchema -DatabaseName $db -ScriptType Evict -SID $sid)
Add-Content "$PWD\evict_$sid.txt" (Get-BrokerDBSchema -DatabaseName $db -ScriptType Evict -SID $sid)
Invoke-Item "$PWD\evict_$sid.txt"

What ended up being the solution was to actually open up the Citrix XenDesktop SQL database from within SQL Server Management Studio and browsing the following table for the orphaned DDC object:

  • ConfigurationSchema.Services
  • MachinePersonalitySchema.Services
  • DesktopUpdateManagerSchema.Services
  • ADIdentitySchema.Services

I was eventually able to find an entry representing the orphaned DDC to generate the SQL script to remove the orphaned DDC so that I am no longer prompted to upgrade the DDC but I can’t help to wonder what will happen when I need to patch the DDC again.

One last note before I end this post is that I was also given a tool named XenDesktop Site Checker:

http://support.citrix.com/article/CTX133767

… that was supposed to be the GUI version of the PowerShell script above.  The instructions I received from the engineer are as follows:

Download the site checker tool from this article and run as administrator on your DDC (Xendesktop Server).  One it run on the left pane it should display the site name and where you can drill down to the Controllers on the controller branch in the tree.  See if the controller that needs eviction come up and right click on that controller, when you do you should see an option to create Evict Script as seen below.  Try to use that evict script to remove the orphan DDC.

clip_image002

I didn’t end up having to use it but figured I’d include it in this post as it might come in handy in the future.

No comments: