Solution
Complete the steps to remove the orphaned Delivery Controller (Controller) from a XenDesktop 7.x site:
-
Run the Get-BrokerController command from PowerShell to get the SID of the orphaned Controller.
-
Execute the following PowerShell script, replacing the XenDesktopDatabase with your XenDesktop database and the DCSID with your SID of the Controller you want to remove:
$DBName = "XenDesktopDatabase"
$EvictedSID = "DCSID"
#
# Generate Database 'Evict' Scripts for XenDesktop DataStore
#
#
Get-ConfigServiceStatus
Get-LogSite
Get-BrokerController -Filter {(SID -eq $EvictedSID)} -MaxRecordCount 2147483647
Add-Content "$PWD\evict_$sid.txt" (Get-AcctDBSchema -DatabaseName $DBName -ScriptType 'Evict' -Sid $EvictedSID)
Add-Content "$PWD\evict_$sid.txt" (Get-HypDBSchema -DatabaseName $DBName -ScriptType 'Evict' -Sid $EvictedSID)
Add-Content "$PWD\evict_$sid.txt" (Get-ProvDBSchema -DatabaseName $DBName -ScriptType 'Evict' -Sid $EvictedSID)
Add-Content "$PWD\evict_$sid.txt" (Get-BrokerDBSchema -DatabaseName $DBName -ScriptType 'Evict' -SID $EvictedSID)
Add-Content "$PWD\evict_$sid.txt" (Get-MonitorDBSchema -DatabaseName $DBName -DataStore 'Site' -ScriptType 'Evict' -Sid $EvictedSID)
Add-Content "$PWD\evict_$sid.txt" (Get-SfDBSchema -DatabaseName $DBName -ScriptType 'Evict' -Sid $EvictedSID)
Add-Content "$PWD\evict_$sid.txt" (Get-EnvTestDBSchema -DatabaseName $DBName -ScriptType 'Evict' -Sid $EvictedSID)
Add-Content "$PWD\evict_$sid.txt" (Get-ConfigDBSchema -DatabaseName $DBName -ScriptType 'Evict' -Sid $EvictedSID)
Add-Content "$PWD\evict_$sid.txt" (Get-LogDBSchema -DatabaseName $DBName -DataStore 'Site' -ScriptType 'Evict' -Sid $EvictedSID)
Add-Content "$PWD\evict_$sid.txt" (Get-AdminDBSchema -DatabaseName $DBName -ScriptType 'Evict' -Sid $EvictedSID)
Add-Content "$PWD\evict_$sid.txt" (Get-AnalyticsDBSchema -DatabaseName $DBName -ScriptType 'Evict' -Sid $EvictedSID)
# Script completed successfully
# Generate Database 'Evict' Scripts for 'Logging' DataStore
#
#
Get-ConfigServiceStatus
Get-LogSite
Get-BrokerController -Filter {(SID -eq $EvictedSID)} -MaxRecordCount 2147483647
Add-Content "$PWD\evict_$sid.txt" (Get-LogDBSchema -DatabaseName $DBName -DataStore 'Logging' -ScriptType 'Evict' -Sid $EvictedSID)
# Script completed successfully
# Generate Database 'Evict' Scripts for 'Monitor' DataStore
#
#
Get-ConfigServiceStatus
Get-LogSite
Get-BrokerController -Filter {(SID -eq $EvictedSID)} -MaxRecordCount 2147483647
Add-Content "$PWD\evict_$sid.txt" (Get-MonitorDBSchema -DatabaseName $DBName -DataStore 'Monitor' -ScriptType 'Evict' -Sid $EvictedSID)
# Script completed successfully
After running the script, the evict.txt file is created under the users profile. The file contains a script required to run on the SQL server.Problem Cause
The XenDesktop 7.x Delivery Controllers had been removed from Active
Directory (AD) before they were removed from the XenDesktop site. The
Controller removal process makes use of stored procedures that require a
valid domain SID to generate the Transact-SQL (T-SQL) eviction script.
When a Controller is removed from AD before attempting to remove it from Studio, the stored procedure fails to generate the necessary part of the T-SQL script that removes the references to the Controller.
When a Controller is removed from AD before attempting to remove it from Studio, the stored procedure fails to generate the necessary part of the T-SQL script that removes the references to the Controller.
Read More ->>