I have been cloning Citrix servers since the days of MetaFrame XP. Over the years I’ve done hundreds of systems and taught a number of people a process for cloning servers that has worked 100% of the time. Unfortunately that process required removing registry keys, running tools to change the SID, and “sterilizing” the image to get it ready to clone. Then once this was done you had to make a copy of the server (in the Bad Old Days we used Symantec Ghost - today we have better imaging tools, which we’ll discuss below), and then move that copy to either different hardware or to a virtualization platform. Then, after copying it, you had to reverse the whole process by adding back registry keys, changing the server name, joining the domain, and finally running “chfarm” (change farm) to join the machine back to the Citrix farm.
About a year and a half ago, Citrix came out with a tool called XenApp Prep, which takes the whole process down from about 30 minutes to just a couple of minutes (not including the amount of time to copy the files). With Windows 2008, the process is simple, and I’m going to tell you exactly how I clone an image. But before I start, I want to stress that, while the process is nearly the same for using XenApp Prep to make a V-Disk image for use with Provisioning Server, there are some slight differences, so be sure to read the “readme” file and the FAQ that come in the XenApp Prep zipped download.
Here are the high-level steps I use to create the server that I’m going to turn into a “Gold” image that I can then use as the source of my cloned image(s):
- First I install Windows Server 2008 and apply all critical OS patches and any optional patches I deem necessary to bring the server up to current standards. (Most IT shops have their own policies and standards for approving and applying patches, so your list may be different from mine.)
- Install any extra pieces that will be required by your application set: j#, .NET (whichever versions you need) with the appropriate SP, Java, etc.
- Turn on the required Terminal Services roles, and, if you are going to place the Web Interface on the server (I don’t personally recommend this), turn on the IIS role.
- When all my prerequisites are met - and you may want to check the admin guide or the Citrix Web site to find the most recent requirements - I install XenApp 5.0.
- Install the most recent Citrix service packs, hotfixes, feature packs, etc.
- Apply any best practices and tweaks necessary. (This is a whole topic by itself, so we won’t try to cover it here.)
- Now, unless I’m using application streaming (another subject we’re not covering here), I install all of my applications. Generally I start with Microsoft Office, because nearly all the time, a customer requires that at least part of the Office Suite be installed. For specific “line of business” and third-party applications, I would always want to work with the customer’s Subject Matter Expert (“SME”) to verify proper operation.
- After the application is installed, I have the SME test the functionality to verify that the application is functioning as would be expected to do whatever it is the business needs the application to do.
If the customer’s SME agrees that the applications are working correctly, I am ready to transform this server into my Gold image. This couldn’t be easier, especially if you’re virtualizing the XenApp servers. (And you know that XenServer is the best virtualization platform for XenApp, right?) Here are the steps:
- Hopefully I was thinking ahead and used a generic name for the server when I built it…but if for some reason I forgot to do that, I change the server name to something generic and reboot.
- Now I download XenApp Prep and install it to the server by running the MSI file. By default, the XenApp Prep installation places its executables in the C:Program FilesCitrixXenAppPrep directory (click image to view full size):
- If you are not creating an image for Provisioning Server - and we’re assuming here that you’re not - then all you do is navigate to the directory shown above and double click the XenAppPrep.exe to run it. (Again, refer to the readme and FAQ that come with XenApp Prep if you are creating an image for PVS.) A command window will appear, run a few commands, and close. That’s it - and that quick little process that took about 15 seconds saved you at least 10 minutes.
- Once XenApp Prep has completed, I next remove the IP address by either setting it to DHCP or to some static IP address. I prefer to set the address to something that’s not on its local subnet, so when it reboots, it cannot communicate until I want it to.
- I now navigate to the C:windowssystem32sysprep directory, and doubleclick the sysprep.exe file to run, select the “OOBE” option (that’s “Out Of Box” Experience, not “Out Of Body”), select the option to shut down the server (not reboot), then click “next,” and sysprep runs - taking only a few seconds to complete:
At this point, you have your Gold image and you’re ready to deploy it over and over again. How do you do that? Again, it couldn’t be any easier:
- Copy the image to a new physical server using whatever imaging tool you prefer - we generally use Ultrabac’s UBDR Gold or Acronis, but whatever tool you prefer should work fine. If you’re virtualizing on XenServer, Hyper-V, or VMware all you need to do is copy the image to another storage repository.
- After the copying process is done - which is the longest step in the process of creating your clone - boot the server up, and follow the sysprep utility prompts (as though you just ran “setup” on a brand new server - hence the “Out of Box Experience”) to give the server its final name. This may take several minutes to complete.
- When sysprep is done, you will need to change the password in order to log on to the system.
- Immediately set the correct IP address and verify that the machine can ping the domain name.
- Go to the system properties and join the machine to your domain.
- Reboot
- When the server comes up this time, and you log onto the domain, your server should have already joined the Citrix farm and be ready to go. Just to be sure, I open a command prompt and type “qfarm” to verify that the server is now a member of the farm.
- Once you’ve confirmed that the server is in the farm, run the Access Suite Console, and configure it to see the farm. Once it comes up, I simply drag and drop the published applications that should be assigned to the new server and it’s ready to go.
- After I drag the applications onto the server, just to be sure, I again run a qfarm command - “qfarm/app” - to verify that the farm sees the new server with the newly allocated published applications on it.
- After you test the new server, make sure you’ve enabled logons on it.
That’s it - you now have another server in your farm, and creating more servers should only take you a few minutes for each one. (Of course the copy process is the slowest part…but you can always use that time to refill your coffee cup, comment on our blog site, or otherwise multitask if you’re really ambitious.)
Pingback: cloning servers - Luke Lives Here
thank you for the instructions very helpful and easy to follow..
The reason no generalise is required is below as above and in summary as posted by another site blogger en quote :
http://www.brajkovic.info/windows-server-2008/the-machine-sid-duplication/
“QUOTED”
Then, in quite a long post, The Machine SID Duplication Myth, he described why having two same SIDs is actually not a security risk. I won’t copy-paste whole post, but here is the bottom line:
It’s a little surprising that the SID duplication issue has gone unquestioned for so long, but everyone has assumed that someone else knew exactly why it was a problem. To my chagrin, NewSID has never really done anything useful and there’s no reason to miss it now that it’s retired. Microsoft’s official policy on SID duplication will also now change and look for Sysprep to be updated in the future to skip SID generation.
So, there is no need to change SIDs anymore. Good news.
“END QUOTE”
http://blogs.technet.com/b/markrussinovich/archive/2009/11/03/3291024.aspx
Also keep in mind that a new version of XenAppPrep is available here : http://support.citrix.com/article/CTX116063 - XenAppPrep ver 4.1.3
I hate is MS sysprep sh*t, i just want to change the SID but when you do “Generalize” it erases all the custom settings I made for this machine!!!
How can i Change the SID without losing all my settings?
This is a complex topic and I would encourage you to read this article by Mark Russinovich (the father of sysinternals) discussing the concept of SID scrambling. Here is the link.
http://blogs.technet.com/b/markrussinovich/archive/2009/11/03/3291024.aspx
Bottom line is that Microsoft’s support policy for cloning servers is to use Sysprep.
Hi, Why you have not selected “Generalize” in Sysprep prompt ? Will there be any problem if we use Generalize with OOBE ?
Thank you, great step-by-step instructions in this blog post. When the server image was created, was the server joined to an AD domain and a Citrix farm as part of the SME verification testing? Was the server unjoined from the AD domain and/or Citrix farm prior to executing the XenApp prep utility? Thanks!