Templates in Citrix XenServer remember mr. SID and mrs. SYSPREP
My experience using templates in XenServer together with XenDesktop
The other day i was doing a Proof of Concept where i help some ppl building a Citrix environment containing multiples Windows Server 2008R2 servers and some Windows 7 machines. I build 1 VM with Windows Server 2008R2 patched it up to latest hotfixes from MS and then converted into a template, that i could use as a OS template for my new VM’s i attend to build for VM’s that was needed for a Domain Controller, Citrix Provisioning Server, XenApp Controller, XenDesktop Controller, File server, SQL server well you get the picture.
I build a new domain with some XenApp 6.5 servers, file servers, provisioning, sql, file servers and everything runs smooth and fast off course its new and clean build =O) then when i wanted to build a Citrix XenDesktop Controller the software installed fine and smooth as it has done multiple times i have build this. When i then wanted to connect to a SQL i got some errors, i troubleshooted it and it seems so weird the SQL issues i had. Well and nice and easy turn was building the SQL express that you can choose within Citrix XenDesktop ISO. I placed the SQL express where i installed the Citrix XenDesktop Controller software. Then lets get things up and running and create and database … new bug.. started to troubleshoot again… hmm. I noticed that all the machines had the same SID that is used when I build them from the template. The solution was building a fresh VM with Windows Server 2008R2, patched it and then install Citrix XenDesktop and then i could connect to the external SQL or to its build-in SQL express if i had chosen that.
I got my lesson learned from Mr. SID.
The case where SID duplication would be an issue is if a distributed application used machine SIDs to uniquely identify computers. And using the machine SID in that way doesn’t work just for the fact that all DC’s have the same machine SID. Citrix XenDesktop relies on unique computer identities either uses computer names or computer Domain SIDs (the SID of the computer accounts in the Domain).
The right way of building a template in XenServer
So the SID really does matter. Prior to taking your clone or image, just remember to use Sysprep as follows:
1) Run Sysprep (on Windows Server 2008 this is located in c:\Windows\System32\Sysprep\Sysprep.exe)
2) Ensure ‘System Out-of-Box Experience (OOBE)’ is selected
3) Tick the ‘Generalize’ option (this resets the SID)
4) Select ‘Shutdown’ from the Shutdown Options.
5) Once the machine has shutdown, take your image and you are good to go!
Good stuff to read about mr. SID
Mark Russinovich explains The Machine SID Duplication Myth (and Why Sysprep Matters)
I used PSGetSID from Microsoft Mark Russinovich http://technet.microsoft.com/en-us/sysinternals/bb897417.aspx to see that all my VMs from the template had the same SID.