# Preparing for XenApp 6 Imaging and Provisioning

Updated: 2011-04-07

Primary deployment methods for XenApp servers include server imaging, virtualization, and provisioning. In XenApp 6 for Windows Server 2008 R2, XenApp server role installation and configuration are separate tasks; this offers flexibility in deciding when to capture (create) XenApp images.

Provisioning a XenApp server uses one of three typical approaches; the approach you use depends on when you configure XenApp (earlier or later) in your preparation steps. The XenApp server joins its farm on the first restart (reboot) after configuration; this ensures that the XenApp server image joins or rejoins the farm after it has been cloned with its final identity.

Important: Cloning is not supported for the first server in the farm (where you created the farm during configuration), and should be used only for creating new member servers for an existing farm.

The following descriptions assume you already created a XenApp farm containing at least one server. You need the data store database information and credentials for the farm.

## Approach 1: Capture an image after XenApp installation, but before configuration and restart

In this approach, you install the XenApp server role, but wait to configure XenApp (join a farm) until after the server is cloned and booted. XenApp server configuration is automated, using a script.

This approach is not supported in Citrix Provisioning Services using Shared Image mode.
1. Install the XenApp server role, but do not configure the server. You may want to restart the server to ensure the system path is updated properly before installing other applications. Deploying prerequisites such as Remote Desktop Services roles may require a server restart before you can install XenApp.
2. Install your applications and configure the settings you want in your image.
3. Run the generalization tools you normally run.
4. Set up a script to run when each cloned server boots. This script configures the XenApp server (including farm information) using the command line (XenAppConfigConsole.exe). The script then restarts the server, whereupon the server joins the farm.

You can set up scripts using typical methods such as Active Directory startup scripts or the RunOnce registry key.

5. Capture an image of the server.

## Approach 2: Capture an image after XenApp installation and configuration, but before restart

In this approach, you install and configure the XenApp server role, but wait to restart the server until after it is cloned. When the server restarts as a clone of the original image, it joins the farm with its new identity.

You do not need direct access to your database server or network during configuration, so this approach can be used to prepare XenApp images for remote deployments. If you do not or cannot verify your database credentials, and they are invalid, XenApp will not join the farm when the server restarts. In that case, run the XenApp Server Configuration Tool, providing correct credentials, and then recapture an image.
1. Install your applications and configure the settings you want in your image.
2. Install the XenApp server role. Deploying prerequisites such as Remote Desktop Services roles may require a server restart before you can install XenApp.
3. Configure the XenApp server to add the server to (join) a farm, but do not restart the server.
4. Run the generalization tools you normally run.
5. Capture an image of the server.
Note: If you are using the SmartAuditor agent or other features that depend on Microsoft Messaging Queuing (MSMQ), use the updated XenApp Server Configuration Tool and the procedure in Approach 3.

## Approach 3: Capture or update an image after XenApp installation, configuration, and restart

If you require XenApp to be installed and working before you create a final image, you must remove the server from the farm, then rejoin the farm before your final shutdown (for example, after sysprep), so that the server will join the farm on the next restart, with its new identity.

Note: You can use this approach with the XenApp Server Configuration Tool included on the XenApp 6 for Windows Server 2008 R2 installation media. However, the process is streamlined and more effective if you use the updated XenApp Server Configuration Tool (see CTX124981) before installing XenApp.
1. Install the XenApp server role.

Optionally, install the Provisioning Services Target Device software. This software resets your network connection during installation. Failures may occur if you install this component from a network location. Although these failures are not commonly harmful, Citrix recommends installing the Provisioning Services Target Device software from a DVD, mounted ISO, or local copy of the installation media.

2. Configure XenApp to join a farm, and then restart (reboot) the server.
3. Install your applications and configure the settings you want in your image.
4. If you are using the Server Configuration Tool from the XenApp 6 for Windows Server 2008 R2 installation media:
1. From the XenApp Server Role Manager, edit your configuration and choose the task to remove the server from the farm. (For a command-line configuration, specify the /ExecutionMode:Leave option.)
2. If you are provisioning the XenApp server with SmartAuditor agent or other features that depend on MSMQ, you must enable MSMQ (manually or scripted) to reset its identifier when the server image boots.
3. Edit your configuration to join the farm again (this requires providing database credentials).
If you installed the updated XenApp Server Configuration Tool, edit your XenApp configuration and select the task Prepare this server for imaging and provisioning. (For a command-line configuration, specify the /ExecutionMode:ImagePrep option.)
• If you are working with an image template that you do not want to keep in the current farm, enable the Remove this current server instance from the farm checkbox. (For a command-line configuration, use the /RemoveCurrentServer:True option.)
• If you are provisioning the XenApp server with SmartAuditor or other features that depend on MSMQ, enabling the Prepare Microsoft Messaging Queuing provisioning checkbox ensures a new unique machine identifier when the server image boots. (For a command-line configuration, use the /PrepMsmq:True option.)
5. Run the generalization tools you normally run.
6. Capture an image of the server.

The server joins the farm when the image boots.

## Resealing an image

If a golden image requires updating (for example, with Citrix or Windows hotfixes, or third-party applications and patches), you can reseal the image. This procedure is similar to approach 3.
1. Boot into the image to make modifications. The XenApp server will try to join the farm if it can.
2. Modify the server as needed.
3. Proceed with step 4 in Approach 3.
During the resealing process, the updated Server Configuration Tool:
• Removes server-specific information, such as WSID in MF20.dsn, WSID in RadeOffline.dsn.
• Creates a unique Secure Ticket Authority (STA) ID in CtxSta.config, using the MAC address.
• Resets the local databases and removes the Servers setting from the Independent Management Architecture (IMA) data store by clearing the IMA local host cache and RadeOffLine databases.
• Places the following configuration information into the Local Group Policy Object (LGPO) if they have nondefault values (nondefault values appear as configured, default values appear as not configured).
• Product feature and server edition
• License server hostname
• License server port number
• XML Service port

## Installation and Configuration Considerations

For provisioning purposes, you can install the XenApp server role using the wizard-based XenApp Server Role Manager or the command line. For wizard-based installations, do not proceed to configuring the XenApp server role until you are ready, based on the approach you select.

When preparing a XenApp server for imaging and provisioning:
• The server should not be the only server in the XenApp farm.
• The server should not be the data collector.
• The server should not have the data store database installed on it.
• The server should not have the Citrix License Server installed on it.
Important: When provisioning XenApp, you must remove the server SSL certificate before running XenConvert; otherwise, the SSL certificate will be distributed to all provisioned XenApp servers.
For example, the following command, issued from the root of the installation media, installs the XenApp server role and the Provisioning Services target device, and excludes installation of the Delivery Services Console.
\XenApp Server Setup\bin\XenAppSetupConsole.exe
/install:XenApp,PVDeviceFeature /exclude:XA_Console

Configuring the XenApp server after it is instanced (approach 1) should be automated using the command line. You can use the wizard-based XenApp Server Configuration Tool or the command line to configure the XenApp server if you choose approach 2 or 3.

For example, the following command, issued from the typical XenApp Server Configuration Tool location (C:\Program Files (x86)\Citrix\XenApp\ServerConfig\XenAppCOnfigConsole.exe), joins the server to the farm, specifying database credentials and the DSN file location, license server information, log file location, and Remote Desktop User Group configuration settings.
“C:\Program Files (x86)\Citrix\XenApp\ServerConfig\
-XenAppConfigConsole.exe" /ExecutionMode:Join
/OdbcUserName:administrator /OdbcPassword:somepasswd
/LicenseServerName:somelicenseserver
/LicenseServerPort:27000 /ZoneName:some_zone_name
/DsnFile:"c:\somepath\to\example.dsn"
/Log:c:\SomewhereConfigLog.txt /CustomXmlServicePort:8080
/AddAnonymousUsersToRemoteDesktopUserGroup:True
/AddUsersGroupToRemoteDesktopUserGroup:True
/AddAuthenticatedUserstoRemoteDesktopUserGroup:True
The following command prepares XenApp for imaging and provisioning. The server will be removed from the current farm, and when the server image boots, it will contain a unique MSMQ machine identifier.
“C:\Program Files (x86)\Citrix\XenApp\ServerConfig\
-XenAppConfigConsole.exe" /ExecutionMode:ImagePrep
/RemoveCurrentServer=True /PrepMsmq:True

© Citrix Systems, Inc. All rights reserved.