Before creating an image of a XenApp server, several steps must be performed to generalize the XenApp installation, in order to remove the machine-specific information from the install and allow the server to come online and join the XenApp farm as a unique entity. In the past, this was either accomplished manually or through the use of a set of scripts. Citrix has since released a small MSI that contains a command-line tool and a Windows service that can be leveraged to quickly generalize a XenApp installation. The tool is called XenAppPrep and it can basically be thought of as the equivalent of sysprep for Windows, only used with XenApp installations.
With XenAppPrep, you can easily prepare and clone your XenApp servers, either by traditional Ghost/image type methods or through the use of Provisioning Services (talked about in my previous post Citrix Provisioning Services Part 2 – PVS with XenApp!). Using XenAppPrep is a simple process:
- Create the server to be cloned, including the installation and configuration of XenApp as well as all of the applications and settings you want in the image.
- Install the XenAppPrep MSI.
- Run the XenAppPrep command-line tool. If the image is going to be deployed using Provisioning Services, use the /pvs switch.
- Run any other generalization tools, such as sysprep, that you would normally run. (Do not use sysprep if the image is deployed through Provisioning Services.)
- Capture an image of the server.
- Push out the image to all servers that will be part of your farm.
When the cloned server starts up, the XenAppPrep service will kick in and reset all of the machine-specific Citrix related information as well as start up the XenApp services. If the server is new to the farm it will be added to the list of farm servers, otherwise it will just take over the existing farm entry for that server name. When the tool is leveraged with the /pvs switch, the XenAppPrep service will always run when the machine starts. Oherwise, the service will only run on the first boot and disables itself after.
An Important Note on XenAppPrep for PVS vDisks
When the vDisk for the XenApp server is in read/write mode for maintenance and patching, it is crucial to run the “XenAppPrep /pvs” tool again prior to shutting down the server and setting it back to read-only mode. However, since the XenAppPrep service is always running when utilized in conjunction with the /pvs switch, an additional step must be taken to accomplish this. The service needs to be stopped and deleted manually prior to running “XenAppPrep /pvs” again. The following snippet of code can be added to a script that is used when sealing up a PVS vDisk with XenApp.
net stop xenappprep
sc delete xenappprep
XenAppPrep can be downloaded from the following Citrix KB article: http://support.citrix.com/article/CTX116063.