Citrix License Server unattended installation with PowerShell and SCCM

The installation and configuration of all Citrix products can be automated. This article covers the Citrix License Server unattended installation with PowerShell and SCCM.

Change Log
23.05.2017: updated to License Server version (11.14.0.1 Build 20104).
31.08.2017: updated to License Server version (11.14.0.1 Build 21103), XD 7.15.
15.01.2018: updated to License Server version (11.14.0.1 Build 22103), XD 7.16.
09.05.2018: new section added: Troubleshooting and Support
Table of Contents

Introduction

Before continuing with this article please be aware of the following:

  • The version of Citrix License Server in this article is 11.14.0.1 build 22103 (released on the 28th of November 2017).
  • The software can be downloaded here:
    https://www.citrix.com/downloads/licensing/
  • The installation and configuration scripts are designed for the following operating systems:
    • Microsoft Windows Server 2008 R2 SP1
    • Microsoft Windows Server 2012 R2
    • Microsoft Windows Server 2016
  • The installation and configuration script have been tested on the following operating systems:
    • Microsoft Windows Server 2008 R2 SP1
    • Microsoft Windows Server 2016
  • The assumption is that you execute the example script in this article on a server which has been pre-installed with one of the aforementioned operating systems including all latest hotfixes.

This article contains two separate scripts; one for the installation of the Windows Roles and Features (optional) and one for the installation and configuration of Citrix License Server.

Part 1: Install Windows Roles and Features (optional)

Before we install the Citrix License Server software, I recommend to install some commonly used roles and features. This step is not absolutely necessary, but I recommend to do it anyway.

In this example we will install the following features:

  • .Net Framework 3.5.1 (for W2K8R2)
  • .Net Framework 4.5.x (for W2K12 and W2K16 only)
  • Desktop experience (for W2K8R2 and W2K12 only)
  • Group Policy Management Console
  • Remote Server Administration Tools (AD DS Snap-Ins)
  • Remote Desktop License Server
  • Remote Desktop Licensing Tools
  • Telnet Client
  • Windows Process Activation Service

As you can see, the Remote Desktop License Server role is added to the Citrix License Server. You can remove this role if you do not need it. As a matter of fact, you can remove any role or feature you do not require.
Please be aware that the Remote Desktop License Server and the Remote Desktop Licensing Tools are two different things.

In PowerShell, roles and features are installed using the Add-WindowsFeature (Windows Server 2008 R2) or Install-WindowsFeature command (Windows Server 2012 and higher). For example:

Windows Server 2008 (R2):

Windows Server 2012 (R2):

Windows Server 2016:

The names of the individual roles and features differ between the various operating systems:

  • .Net Framework:
    • Windows Server 2008 R2 only offers version 3.5.1 (Add-WindowsFeature command NET-Framework-Core)
    • Windows Server 2012 (R2) offers both the versions 3.5.1 and 4.5.x (Install-WindowsFeature command NET-Framework-Core and NET-Framework-45-Core), but I only install the 4.5.x version.
    • Windows Server 2016 only offers version 4.5.x (Install-WindowsFeature command NET-Framework-45-Core)
  • Desktop-Experience:
    This feature no longer exists as a separate item in Windows Server 2016. Let me clarify; when you use the full version of Windows Server 2016 (not the core/nano version), desktop experience is included out-of-the-box.
  • Remote Desktop Licensing Tools:
    In Windows Server 2008 (R2), this abbreviation of this feature is called RSAT-RDS-Licensing. In Windows Server 2012 and higher, this feature is called RDS-Licensing-UI.

To establish the version of the running operating system, I use the following PowerShell command:

In case you use my installation template, this is what the complete script, including logging, looks like:

Execute the script as follows:
powershell.exe -executionpolicy bypass -file %Directory%\Install_Citrix_LicenseServer_Roles.ps1

Log files are created in the directory C:\Logs\Citrix_License_Server_Roles, but you can change this to any directory you want (see lines 63 and 64).

Note:
The installation of the roles and features requires a reboot. The reboot is NOT part of the example script. You can either add it to the script yourself, or if you use a deployment tool such as Microsoft SCCM, you can add a reboot task in the task sequence.

If you want to go one step further and create an SCCM package as well, please follow the step-by-step explanation in the article Deep dive creating SCCM packages for Citrix.

Part 2: Install and configure Citrix License Server:

This second script focuses on the installation and configuration of the Citrix License Server. So how do you start?

  • Create an installation directory on the local computer or on a file share (UNC path). For example: C:\Temp\Citrix\LicenseServer.
  • Create a subdirectory called Files and add the following source files:
    • Citrix License Server installation files (download here):
      • CitrixLicensing.exe
      • CTX_Licensing.msi
    • PowerShell snap-ins for the Citrix License Server:
      Run the installation file LicensingAdmin_PowerShellSnapin_x64.msi. This file contains the PowerShell snap-ins for the Citrix License Server. This file is included in the XenDesktop 7.x ISO file. The ISO file for the version XenDesktop 7.16 can be downloaded here. Extract the file; the MSI file is located in the directory x64\Licensing.
    • Citrix license file(s):
      Add one or more Citrix license files. The PowerShell script below will copy all files ending with the LIC extension to the subdirectory Licensing\MyFiles of the installation directory (which by default is C:\Program Files (x86)\Citrix).

Citrix License Server unattended installation with PowerShell and SCCM - Source files

  • Copy the PowerShell script at the end of this article to a new PS1 file and add this file to the root of your installation directory (not in the subdirectory Files).Citrix License Server unattended installation with PowerShell and SCCM - PowerShell script file
  • Execute the script:
    powershell.exe -executionpolicy bypass -file C:\Temp\Citrix\LicenseServer\Install_CitrixLicenseServer.ps1

The script consists of four parts. The last paragraph of this article contains the complete script:

Install Citrix License Server

The Citrix License Server can be installed as a stand-alone package or from the XenDesktop 7.x ISO file. I choose the stand-alone version. It can be download here: https://www.citrix.com/downloads/licensing/.

The installation can be triggered by either the CitrixLicensing.exe or the CTX_Licensing.msi. I use the CitrixLicensing.exe. For a complete overview of all available installation parameters for both the CitrixLicensing.exe and the CTX_Licensing.msi, see the following Citrix article:
https://docs.citrix.com/en-us/licensing/11-14/getting-started.html#install-components.

In the installation script I added the parameter to configure the four main ports:

  • $LSPORT = "27000" # LSPORT is the port number used for the License Server. Optional parameter. The default is 27000.
  • $VDPORT = "7279" # VDPORT is the port number used for the vendor daemon. Optional parameter. The default is 7279.
  • $MCPORT = "8082" # MCPORT is the port number used for the console. Optional parameter. The default is 8082.
  • $WSLPORT = "8083" # WSLPORT is the port number used for the Web Services for Licensing. Optional parameter. The default is 8083.

You can customize this anyway you see fit (lines 349 to 352 in the complete installation script).

The built-in firewall is configured automatically.

The installation command line is as follows:

The lines 337 to 367 in the complete installation script below cover the installation of the Citrix License Server.

Note:
During installation, a self-signed certificate is generated that is used by the Apache web server to enable a connection through SSL. This self-signed certificate is located in the following directory:

C:\Program Files (x86)\Citrix\Licensing\WebServicesForLicensing\Apache\conf

Follow the procedure in the following Citrix article to replace the self-signed certificate with your own certificate: https://docs.citrix.com/en-us/licensing/11-14/getting-started.html#lic-mgmt-service.

Citrix License Server unattended installation with PowerShell and SCCM - Self-signing server certificate

Install Citrix Licensing PowerShell Snapin

When using the stand-alone license server software, the Windows PowerShell snap-in Citrix.Licensing.Admin.V1 is not part of the downloaded files. You can install this snap-in separately by executing the file LicensingAdmin_PowerShellSnapin_x64.msi. This MSI file is included in the XenDesktop ISO file in the subdirectory "x64\Licensing" (you first have to extract the ISO file). The ISO file for the version XenDesktop 7.16 can be downloaded here.

As with most Citrix products, before you can use the various PowerShell functions, you first have to load the Citrix snap-in(s). Enter the following command in the PowerShell console:

asnp citrix*

Please note that the complete installation script below already includes this command.

To see all available cmdlets within the Citrix.Licensing.Admin.V1 snap-in, enter the following PowerShell command:

Citrix License Server unattended installation with PowerShell and SCCM - All available commands

The lines 373 to 387 in the complete installation script below cover the installation of the Citrix Licensing PowerShell Snapin.

Copy Citrix license files

This part of the script copies your Citrix license files, all files ending with the LIC extension, to the subdirectory Licensing\MyFiles of the installation directory (which by default is C:\Program Files (x86)\Citrix).

In the script I use the same directory as the Citrix License Server installation files, but you can use any source directory you want including UNC paths.

Before I copy the files, I stop the three Citrix License Server services which are started automatically (using the function DS_StopService):

  • Citrix Licensing
  • CitrixWebServicesforLicensing
  • CtxLSPortSvc

After the files are copied, I again start these services (using the function DS_StartService).

Note:
The functions DS_StopService and DS_StartService also checks for depend services. In case the service contains a depend service, this depend service is stopped or started first before the main service is stopped or started.

The lines 393 to 436 in the complete installation script below cover the copy action of the Citrix license files.

Configure Citrix License Server

The last part of the script focuses on the customization of the license server. The one thing I customize is disabling the Citrix Customer Experience Improvement Program (CEIP).

For some reason, Citrix no longer allows the administrator to disable CEIP during installation. The only two possible values during installation are:

  • Diagnostic - Call Home
  • Anonymous - CEIP

Anonymous (CEIP) is the default value. For example:

CitrixLicensing.exe /quiet /l C:\Logs\install.log INSTALLDIR=installdirectory WSLPORT=port_number LSPORT=port_number VDPORT=port_number MCPORT=port_number CEIPOPTIN=Diagnostics

The value None is no longer available during installation and can only be configured afterwards using a PowerShell command.

Use the following command to see the current CEIP configuration:

When configuring CEIP using PowerShell, the following three options are available:

  • None
  • Anonymous
  • Diagnostic

To disable CEIP, run the following PowerShell command using the None option:

If you want to run this command from a remote server, you have to replace localhost for your server name + fully qualified domain name (e.g. myserver.mycompany.com).

In the complete installation script I disable CEIP by setting it to None (see line 460).

Please note that I am not stating that CEIP should be disabled! I am only showing you how to do it in case you want to.

Refer to the Citrix documentation for more information. I recommend to read the section Use the Windows command line to install licensing in the article Get started, install, and configure the License Server.

The lines 442 to 465 in the complete installation script below cover the configuration of the Citrix License Server.

Complete script

In case you use my installation template, this is what the complete script, including logging and a stop-start functions for (depend) services, looks like:

Execute the script as follows:
powershell.exe -executionpolicy bypass -file C:\Temp\Citrix\LicenseServer\Install_CitrixLicenseServer.ps1

Log files are created in the directory C:\Logs\Citrix_License_Server, but you can change this to any directory you want (see lines 313 and 314).

If you want to go one step further and create an SCCM package as well, please follow the step-by-step explanation in the article Deep dive creating SCCM packages for Citrix.

You can customize the above script in any way you see fit. If you have any questions or recommendations please leave a comment below. Happy scripting!

Troubleshooting and Support

Error after opening Citrix Licensing Manager

In case you receive an error after opening the Citrix Licensing Manager (https://licenseserver.mydomain:8083/), this is most likely related to your regional settings.

Citrix License Server unattended installation with PowerShell and SCCM - Error after opening the Citrix License Manager

Go to Control Panel \ Region. On the first tab Formats change the regional settings to English (United States). Please be aware that this setting is a (current) user setting and not a machine setting.

Citrix License Server unattended installation with PowerShell and SCCM - Region format English

To solve this issue for all administrators you could configure this setting in a Group Policy Preference.

Citrix License Server unattended installation with PowerShell and SCCM - Set region format English in Group Policy Preference

This preference item should be included in a Group Policy that is only applied to the license server. This means that the license server should be placed in its own (sub)OU.

Share this post:
Dennis Span on EmailDennis Span on LinkedinDennis Span on Twitter
Dennis Span
Dennis Span
Dennis Span works as a Senior Citrix Architect for a large insurance company in Vienna, Austria. He holds multiple certifications such as CCE-V, CCIA and CCEA. In 2017, Dennis became a Citrix Technology Advocate (CTA). Besides his interest in virtualization technologies and blogging, he loves spending time with his family as well as snowboarding, playing basketball and rowing. He is fluent in Dutch, English, German and Slovak and speaks some Spanish.

6 thoughts on “Citrix License Server unattended installation with PowerShell and SCCM

  1. Pingback: EUC Weekly Digest – March 25, 2017 – Carl Stalhood

  2. Hi Dennis.

    Many thanks for this. I tried the script today for the first time and it worked perfectly. Just a couple of points. The instructions seem to suggest that the PS snapin needs to be run manually before the install script but I subsequently found that this is not the case so perhaps that step can be removed. Also, does this handle upgrades from previous versions or is it just fresh? I suspect the latter but thought I'd ask.

    Great work and thanks for sharing.
    Martyn

  3. Hi Martyn,

    Thanks a lot for your feedback. I appreciate it a lot! I am sorry for confusing you. I have just updated the corresponding section in the article. I hope the description is clearer now.
    And regarding your other question, yes, you are right, the script is intended for new installations. It may work for an upgrade as well, but I never tested this.

    Thanks once again!

    Bye,

    Dennis

  4. Hi Dennis,

    This is a fantastic article and thanks for sharing.

    We have a Windows 2008 R2 Standard virtual machine hosted on VMware ESX running License Server 11.9 (As we use XenDesktop 5.6).

    We are in the process of moving to XenDesktop 7.6 LTSR and we require the License Server to be at 11.14.0.1 Build 20104.

    Can the license server be upgraded easily without causing any necessary outages? - We have the fall back of 720 hours (30days grace period), but just interested if it can be upgraded and how it works. i.e. during the upgrade does it remove the bindings to IIS7 and replace them with some connectivity/bindings to Apache TomCat architecture.

    Best Regards

    • Hi Mark,

      First of all, thanks for your kind remarks!

      The upgrade process of a Citrix license server is fairly easy; it only involves a number of steps (see also the following Citrix article: https://support.citrix.com/article/CTX133277). As you yourself mentioned already, the default grace period is 30 days, which should be more than sufficient for you to upgrade your server. The upgrade should not have any impact on your users, especially if you do it later in the day/evening. Regarding IIS bindings, which ones are you referring to? The license server does not use IIS; it uses Apache TomCat only.

      One other thing; I have not tested my PowerShell-based installation routine for upgrades; only for new installations.

      Bye,

      Dennis

  5. Pingback: Scripting the complete list of Citrix components with PowerShell - Dennis Span

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.