Error "Failed to remove the Citrix Service on Controller<SID>" on running DDC evict script

Error "Failed to remove the Citrix Service on Controller<SID>" on running DDC evict script

book

Article ID: CTX213530

calendar_today

Updated On:

Description

Error on running Controller evict script generated as per article http://support.citrix.com/article/CTX139505 :

Failed to remove the Citrix AD Identity Service on Controller<SID>
An error was occurred during execution of batch. Exiting

or 

Failed to remove the Citrix Machine Creation Service on Controller<SID>
An error was occurred during execution of batch. Exiting

Resolution

Get back a restoration of the SQL DB and remove the DDC using studio if possible.

If not, execute stored procedures for removing services. These stored procedures helps remove any reference that the services still hold for the old Controller.

Follow these steps to run the stored procedures:

Note: Take a backup of the database prior to making any changes 

1. Expand the Citrix database 
2. Browse to the node 'Programmability'
3. Expand 'Stored Procedures'
User-added image
4. Depending on the service for which we are getting the error message, locate the stored procedure corresponding to the service. In case error message "Failed to remove the Citrix Service on Controller<SID>" find  AdIdentityserviceschema.RemoveService.

User-added image
The following is a list of Stored Procedures corresponding to all Citrix services :
  • AdIdentityschema.RemoveService 
  • Analytics.RemoveService
  • AppLibrarySchema.RemoveService.
  • ConfigLoggingSiteSchema.RemoveService
  • ConfigurationSchema.RemoveService      
  • DAS.RemoveService   
  • DesktopUpdateManagerschema.RemoveService 
  • EnvTestserviceSchema.RemoveService
  • HostingUnitServiceschema.RemoveService 
  • Monitor.RemoveService  
  • OrchestrationSchema.RemoveService
  • StorefrontSchema.RemoveService 
  • TrustSchema.RemoveService
Note : DesktopUpdateManagerschema.RemoveService corresponds to Machine Creation Service
 
5. Right Click on above service then click on 'Execute Stored Procedure'
6. Under the tab 'Value', put in the SID of the controller within quotes 
User-added image
7. Click 'OK'

After running the above stored procedure you may have to manually remove the service instances of the controller which was evicted:

Get-configregisteredserviceinstance -serviceaccountsid <> | unregister-configregisteredserviceinstance

Problem Cause

Evict script may fail to unregister service instances for the Controller

Issue/Introduction

This article can be tried in situations where we see errors on running Controller eviction script : http://support.citrix.com/article/CTX139505 The errors can be for any of the Citrix services. For example : Failed to remove the Citrix AD Identity Service on Controller

Additional Information

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