Introduction
In the article Terminal Server Environment Basic Concepts I had explained that a server should be installed silently. Therefore scripts should be created to accomplish this basic concept rule. In this article I will discuss and describe how to perform an unattended installation of Citrix Presentation Server.
Which Version of Presentation Server?
In the last few years Citrix has released several versions of Presentation Server. Luckily, the unattended parameters were not changed in the latest versions, only a few new parameters were added for some new functionality. So this article can be used for Citrix Metaframe XP, MPS3 and CPS4.
The installation of Presentation Server can be divided into two. The first part is the installation of the software where the data store and the farm are created. This is followed by other installations where the server joins the farm (so only the Presentation software is installed).
First installation Preparations
As mentioned above, in this part of our installation procedure, the database is created for the Citrix farm. In small environments Access or MSDE can be used, but in the bigger environments normally SQL is used.
When installing Presentation Server using SQL the database should already be available for installation of Presentation Server. The creation of the database can be done manually on the SQL server, but this can also be done unattended via scripting.
Therefore the SQL command osql.exe can be used. With this tool you can carry out SQL commands from a command line. Therefore some kind of SQL script is necessary which will be called by the osql.exe. Figure 1 shows an example of one for creating a new database. Values in Figure 1 surrounded by "#" should be replaced with real information where:
- #CTXDATASTORENAME#
Should be replaced with the database name within SQL for the datastore
- #SQL_DB_DATAPATH#
The file location of the SQL database files on the SQL server. Normally something like <DRIVELETTER>:\MSSQL\DATA
- #SQL_DB_LOGPATH#
The file location of the SQL log files on the SQL server. Normally something like <DRIVELETTER>:\MSSQL\LOG
- #CTX_ ODBC_USER_NAME#
This parameter is the owner of the database. This account will be created as an SQL account.
- #PWD_CTX_ ODBC_PASSWORD#
The password for the above mentioned user.
The template uses the datastore name to create the files for this database. It is advisable to use the same name for file creation as the SQL database name.
In big environments these values can be replaced by variables via scripting, so the same script can be used on more environments. Change the parameters SIZE, MAXGROWTH and FILEGROWTH to match the needs of your infrastructure.
|
USE master
GO
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'#CTX_DATASTORENAME#')
BEGIN
USE master
PRINT 'Database exists'
RAISERROR ('DataBase #CTX_DATASTORENAME# already exists!', 16, 1)
END
ELSE
PRINT 'Database does not exists'
GO
CREATE DATABASE #CTX_DATASTORENAME#
ON
( NAME = '#CTX_DATASTORENAME#_dat',
FILENAME = '#SQL_DB_DATAPATH#\#CTX_DATASTORENAME#.mdf',
SIZE = 50MB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 10% )
LOG ON
( NAME = '#CTX_DATASTORENAME#_log',
FILENAME = '#SQL_DB_LOGPATH#\#CTX_DATASTORENAME#.ldf',
SIZE = 25MB,
MAXSIZE = UNLIMITED,
FILEGROWTH = 10% )
GO
USE #CTX_DATASTORENAME#
EXEC sp_addlogin '#CTX_ ODBC_USER_NAME#', '#PWD_CTX_ ODBC_PASSWORD#', '#CTX_DATASTORENAME#'
EXEC sp_changedbowner '#CTX_ ODBC_USER_NAME#'
|
Figure 1: Example of new database SQL script for osql.exe
After you have finished modifying the sql script for your own environment you can execute the OSQL command from any machine with the following parameters:
-b , the command will abort when errors are detected. Can be used for error handling in scripts.
-S , the SQL server name where the database need to be created
-U , username with right to connect to the SQL and creating databases, normally SA account
-P ,password for the username
-i ,the sql script file which should be executed.
Using the above variables you might use the following command:
OSQL -b -S %SQL_SRV% -U %SQL_SAUSR% -P %PWD_SQL_SA% -i %TEMP%\NEW_DB.sql
So we have made it possible to create the database for the datastore. Logically we need to connect to this database during the installation of Metaframe. This connection is made via ODBC, so we need to create an ODBC file, which will be used by the Presentation server installation. An ODBC File has the extension .DSN and contains all the information needed for the ODBC driver to connect to the database. (The password will be given as parameter in the Presentation Server installation.) The DSN file is a simple text file with the following format:
[ODBC]
DRIVER=SQL Server
UID=%CTX_ODBC_USER_NAME%
WSID=%COMPUTERNAME%
DATABASE=%CTX_DATASTORENAME%
APP=Citrix IMA
SERVER=%SQL_SRV%
Also for this file, the variables need to be changed to reflect the real values in your environment. If you choose to also script this file, you could use the "ECHO" dos command to create an unattended file. See the example in Figure 2.
|
ECHO [ODBC]>"%TEMP%\SQL.DSN"
ECHO DRIVER=SQL Server>>"%TEMP%\SQL.DSN"
ECHO UID=%CTX_MF_ODBC_USER_NAME%>>"%TEMP%\SQL.DSN"
ECHO WSID=%COMPUTERNAME%>>"%TEMP%\SQL.DSN"
ECHO DATABASE=%CTX_DATASTORENAME%>>"%TEMP%\SQL.DSN"
ECHO APP=Citrix IMA>>"%TEMP%\SQL.DSN"
ECHO SERVER=%SQL_SRV%>>"%TEMP%\SQL.DSN"
|
Figure 2: Example of creating an unattended DSN file
Installing Required Helper Programs
To install Citrix Presentation Server successfully some software needs to already be installed on the server. Logically, this software also should be installed silently with no manual interaction.
For Presentation Server 4 on Windows 2003, MSI installer 3.1 (already included within SP1) and Java Runtime Environment (JRE) 1.4.2 are required.
Because MSI installer 3.1 is provided in the hotfix format it is easy to create an unattended installation. Hotfixes can be installed with different parameters depending on the type of hotfix. The most commonly used are the “–q –m and –z” options or the “/quiet /passive and /norestart” options. Installing an unattended MSI installer can be done using the following command line:
%INSTALLDIR%\WindowsInstaller-KB893803-v2-x86.exe /quiet /norestart
For more information about command line parametersplease look at the following support on the Microsoft Support website.
The second required component for Citrix Presentation Server is the Java Runtime Environment. On CPS4 CD version 1.4.2 it is included as an executable. However like most applications the installation actually is an MSI file with some additional files combined into one executable. As already known, MSI files are perfect for silent installations. The only job to do is to get the content out of that executable. When executing the file the content is extracted and placed in a temporary directory or often %userprofile%\Local Settings\Application Data\<GUID> on the system. So to get those files just start the application on one system. As soon as the first installation Window is displayed all files are available on the system in the temporary directories. Copy all the files and just use the MSIEXEC commands for the silent installation. Combined with this could be the command line for installing JRE "Java 2 Runtime Environment, SE v1.4.2_06.msi" /qb-! REBOOT="ReallySuppress" /liewa "%LOGFILE%.LOG".
Database parameters for SQL
Now that the SQL database is available and the helper applications are scripted we are ready for the Presentation Server silent installation. First let's start with the parameters for creating a farm using SQL for the datastore.
First we need to specify which kind of database we are using. In the parameters Citrix has built in two options: third-party database or a local database. For SQL please use the third party database option (Read it as a non-local database). Accomplish this with the parameter:
CTX_MF_CREATE_FARM_DB_CHOICE with the value Thirdparty.
Obviously the username and password needs to be specified to connect to the SQL server for filling the earlier created database. Use here the same username that you created during the creation of the database. Put this user behind the parameter CTX_MF_ODBC_USER_NAME. The password needs to be given with the parameter CTX_MF_ODBC_PASSWORD. There is also a parameter CTX_MF_ODBC_RE_ENTERED_PASSWORD, but because we already created this user with the osql command this parameter is not necessary.
The last parameter for the database is the pointer to the file with the information about the database server and which database. We have already saved all that information in the DSN file earlier in this article. With the parameter CTX_MF_SILENT_DSNFILE we point the installation to that file.
Conclusion
In this first article of the unattended Citrix installation we have created the database for the datastore unattended. Also the needed DNS connection file is built up automatically. The required helper programs were also installed silently. Also the first parameters related to the database have been described in this article. In the second part of this series I will continue with the remaining parameters for creating and joining the farm. Also the local database parameters will be described in the next article.
Introduction
In the first article I described the automated creation of the Datastore database followed by the creation of an ODBC connection file. Also the required helper applications like MSI Installer 3.1 and Java Runtime Environment were installed silently. In the first article we started with the Citrix Presentation Server installation parameters concerning the database. In this article I will continue with the parameters for creating and joining the farm. I will also describe how to create a farm with a local database.
Create Farm parameters
In the first article we had already described the parameters needed to create the datastore within the predefined database. For the first server, which also creates the farm the following parameters are necessary:
- CTX_MF_FARM_SELECTION=Create
With this parameter the value "create" lets the installation know that this is the first server and that the farm should be created.
- CTX_MF_NEW_FARM_NAME=CTX_FARM_NAME
This parameter specifies the farm name for the Presentation server you are installing. This is a required parameter when installing the first server.
- CTX_MF_ZONE_NAME=CTX_ ZONENAME
With this parameter the zone name can be filled in. If you do not specify this parameter the default zone name, normally the IP range, in which the server exists, will be used.
- CTX_MF_USER_NAME=CTXADMIN_USERNAME
When installing Citrix Presentation server one account can be selected as the Citrix Administrator. This parameter specifies this account and is a required parameter.
- CTX_MF_DOMAIN_NAME=%USERDOMAIN%
Normally the user account used as Citrix administrator will be a domain account. Therefore you need to specify the domain of the user at the parameter CTX_MF_USER_NAME with this parameter. This parameter is required.
- CTX_MF_ADD_LOCAL_ADMIN=Yes/No
Within Citrix Presentation Server it is possible to add all members of the local administrator group to the Citrix Administrator role. With the value Yes these users are added. If not specified the default value will be used, which is No (so that the users are not added).
- CTX_MF_ADD_ANON_USERS
With this parameter you can choose to disable the creation of the fifteen anonymous local accounts when using the value No. When the parameter is not used the default Yes (creating the users) will be used. When the parameter CTX_MF_CREATE_REMOTE_DESKTOP_USER is used with the value AddEveryone this parameter is ignored and the anonymous accounts are created during installation.
- CTX_MF_CREATE_REMOTE_DESKTOP_USERS
This parameter determines if users are added to Remote Desktop Users group. Only users added to this group have the option to use Terminal Services/Citrix. Three values can be used:
- AddEveryone: authenticated users are added to the Remote Desktop Users group.
- CopyUsers: Copies all current users in the local user group to the Remote Desktop Users group.
- DoNothing: Nothing is added to the Remote Desktop Users group. You could use AD command line tools to accomplish adding your specific group or users to this group.
Default value is CopyUsers when this parameters is not specified.
- CTX_MF_SHADOWING_CHOICE=Yes CTX_MF_SHADOW_PROHIBIT_REMOTE_ICA=No
CTX_MF_SHADOW_PROHIBIT_NO_NOTIFICATION=Yes
CTX_MF_SHADOW_PROHIBIT_NO_LOGGING=No
These parameters are used to specify how Citrix Remote Control is configured. With the parameter SHADOWING_CHOICE you enable or disable the Remote Control functionality.
The parameter REMOTE_ICA specifies if a remote keyboard and mouse may be used during Remote Control. Please note that the value No allows usage of the remote keyboard and mouse.
The last two parameters configure Remote Control behavior. CTX_MF_SHADOW_PROHIBIT_NO_NOTIFICATION configures if users are notified when Remote Control is being used. No allows no notification, Yes ensure that notification is always used. CTX_MF_SHADOW_PROHIBIT_NO_LOGGING configures the logging of the remote control sessions. No allows logging, Yes ensures that logging can not be used.
- CTX_MF_XML_CHOICE=Separate
CTX_MF_XML_PORT_NUMBER="80"
If IIS is installed on the same machine as a Presentation Server (which is not advisable) both IIS and the Citrix XML service use the same port. If this situation exists you can, with the parameter CTX_MF_XML_CHOICE, specify if IIS and the XML share (value: share) or use both their own (separate) port number. With CTX_MF_XML_PORT_NUMBER the port number for the XML service can be defined (default is 80, which will be used if the parameter is not specified).
- CTX_MF_LIC_CHOICE_FOR_CREATE=DontKnow
When creating the farm normally the installation asks for the license server or to fill in the license server later. This parameter answers the same question. With the value DontKnow the installation does not fill in any License Server information. When given the value Point, the installation fills in the name specified by CTX_MF_LICENSE_SERVER_NAME.
- CTX_MF_LICENSE_SERVER_NAME=%COMPUTERNAME%
CTX_MF_LICENSE_SERVER_PORT=27000
When using the parameter CTX_LIC_CHOICE_FOR_CREATE (or the parameter CTX_MF_LIC_CHOICE_FOR_JOIN_OR_UPGRADE in a join script) the value of the parameter CTX_MF_LICENSE_SERVER_NAME will be used as the license server name and the value of CTX_MF_LICENSE_SERVER_PORT will be used as the Citrix license port (standard 27000, will be used when parameter is not specified).
- CTX_MF_SERVER_TYPE=E
For all versions of Citrix Presentation Server the same source is used. With this parameter you can specify which you would like to install. Values can be S (Standard Edition), A (Advanced Edition) and E (Enterprise Edition). When this parameter is not specified the Enterprise Edition will be installed.
- CTX_MF_ONLY_LAUNCH_PUBLISHED_APPS=Yes
If you are using Published Applications only, you could enforce that only Published Applications can be used. I advise not to use this parameter and configure it later via policies, so that you allow more flexibility within your configuration.
- CTX_MF_LAUNCH_CLIENT_CD_WIZARD=No
Specifies whether or not to use ICA Client Distribution wizard within your installation. Mostly Citrix Administrators choose to use another distribution mechanism or add these clients later to the Presentation Server.
- CTX_ADDLOCAL
With this parameter you can specify which components (like Resource Manager, Installation Manager, Packager, etcetera) of Presentation Server should be installed on your server. All possible values are explained (just like all parameters) in the Citrix Administrators Guide in Appendix B.
- MSIEXEC parameters
To finish off the silent installation the standard MSIEXEC command should be added. To suppress the reboot after the installation, use the parameters REBOOT=ReallySuppress. To choose a different installation path than default, use the parameter INSTALLDIR. If you would like to log the installation, use the parameter /liewa with a logfile specified. Include /qr to silently run the MSI file.
Above we mentioned the most used parameters. Although there are a few more, normally you do not need those. Figure 1 shows an example of how to combine the parameters within the silent installation.
|
msiexec /i "\mps.msi" /qr CTX_MF_FARM_SELECTION="Create" CTX_MF_CREATE_FARM_DB_CHOICE="Thirdparty" CTX_MF_ZONE_NAME="StandardZone" CTX_MF_SILENT_DSNFILE="%TEMP%\SQL.dsn" CTX_MF_ODBC_USER_NAME="ctx_db_user" CTX_MF_ODBC_PASSWORD="password" CTX_MF_NEW_FARM_NAME="Company Farm" CTX_MF_USER_NAME="administrator" CTX_MF_DOMAIN_NAME="vanbragt.net" CTX_MF_SHADOWING_CHOICE="Yes" CTX_MF_LIC_CHOICE_FOR_CREATE=DontKnow CTX_MF_SHADOW_PROHIBIT_REMOTE_ICA="No" CTX_MF_SHADOW_PROHIBIT_NO_NOTIFICATION="Yes" CTX_MF_SHADOW_PROHIBIT_NO_LOGGING="No" CTX_MF_XML_PORT_NUMBER="80" CTX_MF_LAUNCH_CLIENT_CD_WIZARD="No" CTX_MF_SERVER_TYPE="E" REBOOT="ReallySuppress" /liewa "%LOGFILE%.log" INSTALLDIR="c:\serverapps\"
|
Figure 1: Example silent installation for creating Citrix farm
Join Farm parameters
When the first server is up and running more Citrix Presentation servers can be added to the farm. Logically this can also be unattended. Because the database already exists, in this script you only need to create the DSN file (exactly the same as the create script) and install the required helper applications.
For the Presentation Server installation some special parameters should be used in order to create the join script.
First of all the parameter CTX_MF_FARM SELECTION is required, this time with the value JOIN. Also for the license server a special parameter is available.
The parameter CTX_MF_LIC_CHOICE_FOR_JOIN_OR_UPGRADE should be used for providing information for the license server. Values are POINT (combined with the parameter CTX_MF_LICENSE_SERVER_NAME) or the value “UseFarmSettings”. With the value UseFarmSettings the license server is not checked and the installation assumes that the license server is filled in correctly within the farm.
To complete the silent installation some more parameters are required, but they are exactly the same as in the creation installation. CTX_MF_CREATE_FARM_DB_CHOICE, CTX_MF_SILENT_DNSFILE, CTX_MF_ODBC_USER_NAME, CTX_MF_ODBC_PASSWORD, CTX_MF_USER_NAME, CTX_MF_DOMAIN_NAME are required parameters.
Figure 2 shows an example of a "joining" installation script.
|
msiexec /i "\mps.msi" /qb-! CTX_MF_FARM_SELECTION="Join" CTX_MF_CREATE_FARM_DB_CHOICE="Thirdparty" CTX_MF_ZONE_NAME="Standard Zone" CTX_MF_SILENT_DSNFILE="%TEMP%\SQL.dsn" CTX_MF_ODBC_USER_NAME=ctx_db_user " CTX_MF_ODBC_PASSWORD="”passwird" CTX_MF_NEW_FARM_NAME="Company Farm" CTX_MF_USER_NAME="adnubustrator" CTX_MF_DOMAIN_NAME=”vanbragt.net" CTX_MF_SHADOWING_CHOICE="Yes" CTX_MF_SHADOW_PROHIBIT_REMOTE_ICA="No" CTX_MF_SHADOW_PROHIBIT_NO_NOTIFICATION="Yes" CTX_MF_SHADOW_PROHIBIT_NO_LOGGING="No" CTX_MF_XML_PORT_NUMBER="80" CTX_MF_LAUNCH_CLIENT_CD_WIZARD="No" CTX_MF_SERVER_TYPE="E"
REBOOT="ReallySuppress" /liewa "%LOGFILE%.log" INSTALLDIR="%CTX_INSTPATH%"
|
Figure 2: Example silent installation for joining Citrix farm
Parameters for creating a farm with a local database
In small environments you can choose not to use a third-party database (like SQL or Oracle) but an Access or MSDE database. Using these kinds of databases are supported for unattended installation of Citrix Presentation Server. For preparation only the required helper programs are needed. No DNS file is needed for a local database installation.
The farm and the database are created during the first part of the process. First of all, you need to specify the database choice. Therefore the parameter CTX_MF_FARM_DB_CHOICE is also used. For local databases the value should be Local.
Secondly when using the local value for this parameter the CTX_MF_LOCAL_DATABASE is also required. If using an Access database the value should be Access and when using the MSDE the value should be SQL.
If you are using MSDE you can, if you wish, fill in the instance name of the database with the parameter CTX_MF_MSDE_INSTANCE_NAME (default is Citrix_Metaframe). The parameters CTX_MF_NEW_FARM_NAME, CTX_MF_USER_NAME, CTX_MF_DOMAIN_NAME and CTX_MF_FARM_SELECTION are the other required parameters (already explained at the create farm with SQL section in this article).
Joining a farm using a local database also requires some different parameters. Basically these parameters point to the server hosting the database for this farm.
To connect to this machine a user account should be provided with access to this server. This information needs to be filled in using the parameters CTX_MF_INDIRECT_JOIN_USER_NAME and CTX_MF_INDIRECT_JOIN_DOMAIN_NAME. Logically also the server hosting the database should be specified. Therefore the parameter CTX_MF_JOIN_FARM_SERVER_NAME is available. If the default IMA port is changed on your infrastructure you could define the parameter CTX_MF_JOIN_FARM_SERVER_PORT with the right value. Also the parameters CTX_MF_FARM_SELECTION with value Join and CTX_MF_JOIN_FARM_DB_CHOICE=Indirect are required for a successful installation.
With both scripts the same other parameters can be used to customize the application to your needs.
Conclusion
Citrix offers lots of possibilities for a silent installation of Citrix Presentation Server. Within this series I described how to create a full silent installation for Citrix Presentation server in combination with an SQL database. Also all useful parameters were explained with their values, so you can create your own customized unattended installation.
The content of this two part article is based on my professional experience and the best practices we use within Login Consultants. Feel free to give any feedback or comments!