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'
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.

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
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