XenApp 4.5 / 5 unattended installation

Unattended installation is very usefull in large XenApp farm, of course if you’re deploying one server per two month you might not be interessed by this process automation but this is always interresting to know this kind of tips. Scripts bellow are example I use every day in production to install servers, of course its needs to be change and adapt to your own settings and of course if you have some ideas to share, I take it !

This unattended example assume you have only one network card enable, a local XenApp source installation file and IP address type 192.168.3 / 192.168.10 / 192.168.200 / 10.113 / 10.112. This file allow to join an existing farm named CTX_TEST with a datastore hosted on a SQL server. Finally, you need to create one folder per farm inside your XenApp source folder if you are automating multi farm setup.

This is the UnattendedTemplate.txt you can find on your XenApp installation media, this file is very simple to fill and everything is comment and explain. This file example is for the XenApp zone named ZoneA

I wanted to comment every option bellow but I think existing comments are very clear and you will understand everything. If you have any question, just ask on the forum.

***************************************************************
* This is a sample answer file for unattended installations of
* Citrix XenApp 5.0.
*
* To run an unattended installation of XenApp,
* make a copy of this file and customize it for
* your needs.
*
* If you do not use an answer file or if you use an answer
* file but do not specify answers to some questions, default
* answers are used for those questions. The default answers
* in the installation are identical to the default answers
* listed in this sample answer file.
*
* This file installs only components contained in mps.msi.
* You must install prerequisites, including a Citrix XenApp
* Plugin for Hosted Apps from the XenAppHosted.msi, before
* installing XenApp. See the "Stage 4: Configure Pass-Through
* Client Authentication" section in the Citrix XenApp
* Installation Guide.
*
* Important: For security reasons, account passwords are not
* stored in this file and must be provided in the command-line
* when you run the answer file. For information about the
* msiexec commands used for providing credential information,
* see the “Setup Property Names and Values” section in the
* “XenApp Windows Installer Properties Reference” chapter of
* the Citrix XenApp Installation Guide.
*
* For information about installing XenApp, see the
* Citrix XenApp Installation Guide and the XenApp Installation
* Checklist. For information about Setup properties for
* other components, see their respective administrator's
* and installation guides.
*
***************************************************************
 
***************************************************************
* Citrix License Agreement
*
* This section specifies your acceptance of the Citrix End-User
* License Agreement. Set this value to "Yes" to
* indicate your acceptance of the Citrix End-User License
* Agreement.
*
* The unattended installation fails if you use any value other
* than"Yes".
***************************************************************
 
[Citrix License Agreement]
AcceptLicense=Yes
 
***************************************************************
* Data Store Configuration
*
* This section specifies whether you are creating or joining a
* farm and how to connect to the data store.
*
* Multiple options are available as follows:
*
* -> To create a farm using an Oracle, Microsoft SQL Server, or
*    IBM DB2 database:
*    - Set CreateFarm to Yes
*    - Set DirectConnect to Yes
*    - Complete the Direct Connect Settings section
*    - Complete the Farm Settings section
*
* -> To create a farm using an Access database:
*    > Set CreateFarm to Yes
*    - Set LocalDBType to Access
*    - Set DirectConnect to No
*    - Complete the Farm Settings section
*
* -> To create a farm using a SQL Server Express database:
*    - Set CreateFarm to Yes
*    - Set LocalDBType to SQL
*    - Set DirectConnect to No
*    - Complete the Farm Settings section
*
*
* -> To join a farm using an Oracle, SQL Server, or DB2
*    database:
*    - Set CreateFarm to No
*    - Set DirectConnect to Yes
*    - Complete the Direct Connect Settings section
*
* -> To join a farm by connecting to an Access or SQL Server Express
*    database stored on another server (Indirect Connection):
*    - Set CreateFarm to No
*    - Set DirectConnect to No
*    - Complete the Indirect Connect Settings section
*
*
* Specify the name of the zone where this server will reside.
* If no zone name is specified, a default zone name is applied
* to the first server in a farm. If no zone name is specified
* for servers joining a farm, the servers are added to the zone
* of the first server in the farm.
*
* If you are using an Oracle, SQL Server, or DB2 database,
* manually create a .DSN file within the ODBC Data Source
* Administrator "File DSN" option before running the unattended
* installation process.
*
* IMPORTANT: Read the Citrix XenApp Installation
* Guide and the Citrix XenApp Administrator's
* Guide for information about data store configuration, supported
* databases, setting up a DSN file, moving servers within
* farms, and renaming zones.
***************************************************************
 
[Data Store Configuration]
CreateFarm=No
LocalDBType=
DirectConnect=Yes
; Leave this blank to use the default zone name
ZoneName=ZoneA
 
***************************************************************
* Direct Connect Settings
*
* This section specifies settings for an Oracle, SQL Server, or
* DB2 database.
*
* This section is used only if the value for DirectConnect is
* Yes in the Data Store Configuration section.
*
* In this section, specify the path to the DSN
* file for this database:
*    - If you are creating a farm, see the Citrix XenApp
*      Installation Guide for details on how to
*      create a DSN file to use here.
*    - If you are joining a farm, specify the path
*      to the DSN file created on the server where you
*      created the farm or a copy of it. For details, see the
*      Citrix XenApp Installation Guide.
*
* Note: Specifying passwords in the unattended answer file is
* not supported for security reasons. When you run the command
* to install XenApp using this answer file, add the
* CTX_MF_ODBC_PASSWORD Setup property to the command line.
*
* If Windows NT authentication is being used, include
* the domain in the user name in the form domain\username.
* This command is described in the Citrix XenApp
* Installation Guide.
* Note: Fully Qualified Domain Names are not supported.
***************************************************************
 
[Direct Connect Settings]
DSNFilePath=c:\Citrix\XenApp5\CTX_TEST\MF20.dsn
UserName=CTXTEST_RW
Password=password123654
* To specify the password, use the CTX_MF_ODBC_PASSWORD Setup
* property.
*
*
***************************************************************
* SQL Server Express Settings
*
* This section specifies which SQL Server Express settings to use when
* connecting to the database.
*
* Use this section if you set CreateFarm to Yes and
* LocalDBType to SQL
*
* In this section, specify the name of the SQL Server Express
* instance to use when connecting to the data store. The
* default is CITRIX_METAFRAME.
*
*
***************************************************************
 
[SQL Server Express Settings]
InstanceName=CTX_TEST
 
***************************************************************
* Indirect Connect Settings
*
* This section specifies settings for connecting indirectly to
* an Access or SQL Server Express database on another server.
*
* This section is used only if CreateFarm is No AND
* DirectConnect is No.
*
* In this section, specify:
*
* 1. The name of the server you want to indirectly connect to
*    and the port number to use.
*
* 2. The username and domain of the farm administrator account
*    that can access the first server in the farm.
*
* Note: Specifying passwords in the unattended answer file is
* not supported for security reasons. When you run the command to
* install XenApp using this answer file, add the
* CTX_MF_INDIRECT_JOIN_PASSWORD Setup property to the command line.
* This property is described in the Citrix XenApp
* Installation Guide.
*
* Note: When using the indirect connect settings, you must specify
* the domain name and the user name since both fields are required.
* Fully Qualified Domain Names are not supported.
***************************************************************
 
[Indirect Connect Settings]
IndirectServerName=
IndirectServerPort=2512
UserName=
DomainName=
 
*To specify the password, use the CTX_MF_INDIRECT_JOIN_PASSWORD Setup
*property in the command line.
 
***************************************************************
* Farm Settings
*
* This section specifies the settings for creating a farm.
*
* This section is used only if CreateFarm is Yes in the Data
* Store Configuration section.
*
* In this section, specify:
*
* 1. The name of the farm you are creating.
*
* 2. A Windows NT user (user name and domain) who will be the
*    administrator of this farm. This user can later designate
*    other users as administrators of the farm using the
*    XenApp Advanced Configuration tool.
***************************************************************
 
[Farm Settings]
FarmName=CTX_TEST
FarmAdministratorUsername=
FarmAdministratorDomain=
 
***************************************************************
* Shadowing Restrictions
*
* This section specifies whether or not shadowing is enabled. If
* shadowing is enabled, this section specifies shadowing
* restrictions.
***************************************************************
 
[Shadowing Restrictions]
AllowShadowing=Yes
ProhibitRemoteControl=No
ProhibitNotificationOff=No
ProhibitLoggingOff=No
 
***************************************************************
* Citrix XML Service
*
* This section lets you specify if you want the XML Service to use
* a dedicated port or share a port with IIS.
*
* The default port is 80 for the XML service. If IIS is installed,
* you can share port 80 between IIS and the XML service,
* or you can dedicate a different port to the XML Service.
*
*
* If ExtendIIS is set to No, the specified port is used for the
* Citrix XML Service, and EnableVirtualScripts is ignored.
* If ExtendIIS is set to No and IIS is installed (or any
* service is already using port 80), Citrix XML Service takes the
* secondary default port as 8080.
*
* If ExtendIIS is set to Yes, DedicatedPortNumber is ignored
* and EnableVirtualScripts is used to decide if the virtual scripts
* directory will be created. It will be created ONLY if
* Virtual Scripts Directory does not yet exist on the system. If it exists,
* EnableVirtualScripts has no effect on the installation.
*
* If you do set ExtendIIS to Yes and IIS is not available, the
* dedicated port number is used.
*
* If you do set ExtendIIS to Yes and IIS exists and
* VirtualScriptsDirectory does not yet exist on the system but
* EnableVirtualScripts is set to No, installation fails.
*
* If you do not use the default port 80, all XenApp plugins
* using TCP/IP with HTTP server location must be configured to
* make requests to the specified port number.
*
* If ExtendIIS is set to Yes and you are installing on Windows
* Server 2008 x64 Edition, the ExtendIIS setting
* will be disregarded and ExtendIIS set to No.
***************************************************************
 
[Citrix XML Service]
ExtendIIS=No
; This setting applies only if ExtendIIS is No
DedicatedPortNumber=80
; This setting applies only if ExtendIIS is Yes
EnableVirtualScripts=Yes
 
***************************************************************
* Options
*
* This section contains additional options for unattended
* installation.
*
* - RebootOnFinish -
*
* RebootOnFinish specifies whether Setup shuts down and restarts
* the server after the installation completes.
*
* If you set RebootOnFinish to No, manually restart the server
* before using XenApp.
*
* - LogLevel -
*
* LogLevel specifies the granularity of Windows Installer logging in
* the log file.
*
* To disable Windows Installer logging, set LogLevel to No.
*
* To configure Windows Installer logging, set LogLevel to one of the
* following values:
*
* 	*	everything (the same as using all options listed
*               below for voicewarmup)
* 	v	verbose
* 	o	out of disk space
* 	i	informational messages
* 	c	command line parameters
* 	e	error messages
* 	w	warning messages
* 	a	action execution messages
* 	r	informational messages for the currently
*               running action
* 	m	out of memory errors
* 	u	user request messages
* 	p	property values
* 	+	append to an existing log file
* 	!	flush each line to the log
*
*
* Logfile specifies the path to the log file for the
* installation.
*
* - UILevel -
*
* UILevel specifies how much appears on the screen during
* the silent installation. Default is BASIC_UI_NO_MODAL.
* You can set UILevel according to one of the following:
*
* NO_UI
* BASIC_UI
* BASIC_UI_NO_MODAL
* BASIC_UI_MODAL
* REDUCED_UI
*
* NO_UI is equivalent to the msiexec q option. Setup
* displays no UI.
*
* BASIC_UI is equivalent to the msiexec qb option. Setup
* displays basic UI, but hides Cancel buttons.
*
* BASIC_UI_NO_MODAL is equivalent to the msiexec qb-
* option. Setup displays no modal dialog boxes.
*
* BASIC_UI_MODAL is equivalent to the msiexec qb+ option.
* Setup displays no UI except for a modal dialog box
* at the end of the installation.
*
* REDUCED_UI is equivalent to the msiexec qr option.
* Setup displays a reduced UI without a modal dialog box
* at the end of the installation.
*
*
***************************************************************
 
[Options]
RebootOnFinish=No
LogLevel=*v
LogFile=c:\XENAPPCTX_PROD.log
 
IgnoreMCM=No
RemoveWITurnkey=No
 
***************************************************************
 
* XenApp
*
* ServerType specifies the edition of XenApp that you
* are installing.
*
* Supported values:
*      Platinum (Platinum Edition)
*      Enterprise  (Enterprise Edition)
*      Advanced  (Advanced Edition)
*
***************************************************************
 
[PresentationServer]
ServerType=Enterprise
 
***************************************************************
* Citrix License Server
*
* This section describes the Citrix License Server settings.
*
* If CreateFarm is set to Yes, supported values for
* LicenseServerChoice are:
*
* - "Point"
* - "DontKnow"
*
* If CreateFarm is set to No, supported values for LicenseServerChoice
* are:
*
* - "Point"
* - "UseFarmSettings"
* - "DontKnow"
*
* If you set LicenseServerChoice to "Point," set
* LicenseServerName to either the name of the license server
* or its IP address.
*
* If you want to set a different license server port from the
* default value, you must set both LicenseServerPortDefault=No and
* LicenseServerPort. For example:
*
* LicenseServerPortDefault=No
* LicenseServerPort=27009
*
***************************************************************
 
[LicenseServer]
LicenseServerChoice=UseFarmSettings
 
LicenseServerPortDefault=Yes
LicenseServerPort=27000
 
***************************************************************
*
* MFRDP (Remote Desktop Protocol)
*
* Set DisableRDPPrompForPassword to "Yes" if you enable
* Terminal Services to accept credentials directly from the
* Remote Desktop Windows Client.
*
* If you set DisableRDPPrompForPassword to "No" users are
* prompted for credentials each time they connect using
* Remote Desktop Protocol.
*
***************************************************************
 
[MFRDP]
DisableRDPPromptForPassword=Yes
 
***************************************************************
*
* IMA Encryption
*
* Setting EncryptionEnable to 1 instructs Setup to enable IMA
* Encryption for the farm during a Create Farm server installation.
*
* This option is only relevant for a Create Farm installation. If you
* need to enable encryption on a join, use the console. The default
* is 0.
*
* Set KeyType to "generate," "file," or "existing" to indicate how
* Setup will receive the IMA Encryption settings. The default is "file."
*
* Set NewKeyPath to the complete path where you want the generated key to
* be saved. This option is only available when using KeyType=generate.
*
* Set KeyPath to the location where an already-generated key will be loaded.
* This option is only available when using KeyType=file.
*
* The KeyPath, NewKeyPath, and KeyType attributes are useful only when they
* are used in conjunction. Setting one of the options and not the other will
* result in the encryption key not being loaded.
*
***************************************************************
 
[IMAEncryption]
EncryptionEnable=0
KeyType=file
NewKeyPath=
KeyPath=

And if you want to go further, you can create one file per zone and use a script to deploy your XenApp server to the right zone while checking the machine IP address. This script needs XenApp installation files locally on your server (c:\Citrix\XenApp5).

On Error Resume Next
 
Dim objShell
Dim WshNetwork
Dim INSTMF
Dim objFSO
 
Set WshNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
' ---------------------------------------------------------------------
' ---------------------------------------------------------------------
' ------------------------ Zoning XenApp ------------------------------

Dim objWMIService, IPConfigSet, IPConfig, IPAddr, TabloIP, SrvSite
 
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\.\root\cimv2")
 
Set IPConfigSet = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
 
' This part check if more than one network card is enable
If IPConfigSet.count <> 1 Then
	Err.Raise "666","Network card check","Two network card are enable, XenApp zoning will now stop"
	wscript.echo "Error : " & err.number & " \ " & err.description
	WScript.Quit(Err.Number)
Else
	IPAddr = ""
	For Each IPConfig in IPConfigSet
	    If Not IsNull(IPConfig.IPAddress) Then
        	For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
	            IPAddr = IPConfig.IPAddress(i)
        	Next
    	End If
	Next
	TabloIP=split(IPAddr,".")
	If TabloIP(0) & "." & TabloIP(1) = "10.113" Or TabloIP(0) & "." & TabloIP(1) = "10.112" Then
		SrvSite = "ZoneD"
	Else
		Select Case TabloIP(0) & "." & TabloIP(1) & "." & TabloIP(2)
			Case "192.168.3"
				SrvSite = "ZoneA"
			Case "192.168.10"
				SrvSite = "ZoneB"
			Case "192.168.200"
				SrvSite = "ZoneC"
			Case Else
				SrvSite = "UNKNOW"
				Err.Raise "666","UNKNOW IP","This zone isn't setup in the installation process"
				wscript.echo "Erreur : " & err.number & " " & err.description
				WScript.Quit(Err.Number)
		End Select
	End If
End If
' ---------------------------------------------------------------------

objShell.CurrentDirectory = "C:\Citrix\XenApp5"
' This is the command line installation
INSTMF = objShell.Run("""CTX_TEST\UnattendedInstall.exe"" ""XenApp Server\w2k8x64\mps.msi"" " & Chr(34) & "CTX_TEST\CTX_TEST-" & SrvSite & ".txt"" " & Chr(34) & "CTX_MF_ODBC_PASSWORD=passwors123654 /qb-",9,true)
 
If Err.Number <> 0 Then WScript.Quit(Err.Number)

This unatended installation generate a verbose log file on c:\XENAPPCTX_PROD.log , don’t under estimate this part, it can be very usefull to troubleshoot your silent installation.

One last thing before you go, don’t forget to use a valid MF20.dsn :

[ODBC]
DRIVER=SQL Server
UID=CTXTEST_RW
Network=DBMSSOCN
DATABASE=CTX_TEST
APP=Citrix IMA
SERVER=DBINSTANCE_NAME

Post author