Issues with creating Machine Catalog and delivery groups on XenDesktop.
1. Take a back up of your database along with the snapshots of both the Delivery Controllers and your SQL servers as a precautionary measure.
2. Run the XDDBDiag tool on any of the controllers by logging in with your Citrix Admin account. Below is the process you need to follow to run the tool. *You can download the tool from http://support.citrix.com/article/CTX128075
a. Open command prompt after logging in with the Citrix admin account.
b. Browse to the directory where you have the tool downloaded.
c. Run the executable file in this format: XDDBDiag.exe windows Amg-wal-sql04\citrixsql1 AMG_WAL_XenDesktop
3. Once the commands executes, three files will be created in the same directory where you have the tool.
4. Unzip the file that gets created, and open the file chb_State.AccountNames.
5. Make a note of the UID along with the SID for the entries that has ONLY SID listed and NO cname or UPN listed.
6. Once you note the SIDs, check in your AD users and computers if there are any user associations to these SIDs.
7. You can either use the tool PSGetSID to check if there are any username associations.
*Option for retrieving SID without downloading tool: http://www.windows-commandline.com/get-sid-of-user/
*Option for retrieving SID without downloading tool: https://technet.microsoft.com/en-us/library/ff730940.aspx
8. You need to download the tool from https://technet.microsoft.com/en-us/sysinternals/bb897417.aspx. Once you have the tool downloaded, browse to the directory from command prompt, and run the command: psgetsid SID_of_the_user_account.
For example, if you are querying the SID S-1-125-12345, then you need to run the command in the format: psgetsid S-1-125-12345. This will give you the account that is currently being used by that SID.
9. Ignore the SIDs that has any user association from your current domain. Only make a note of the SID that either has no user association or has an association with your previous domain.
10. Once you have the list of all the stale entries of SID along with its UID, open the file chb_Config.Accounts from the same directory.
11. Now search for the SIDs, that you listed before, in this directory and make sure that it has the same Uid.
12. Once you have the UID and SID of all the stale entries, you need to run the following queries on your database:
a. Query for removing the entry from table chb_State.AccountNames:
delete FROM [AMG_WAL_XenDesktop].[chb_State].[AccountNames]
where uid=xx;
b. Query for removing the entry from table chb_Config.Accounts:
delete FROM [AMG_WAL_XenDesktop].[chb_Config].[Accounts]
where uid=xx;
There were stale entries of the users from the previous domain in the database.