Automating the Citrix App Layer

Introduction:
If your daily job has anything to do with virtual workspaces, you definitely have heard something about app layering. App layering is seen as the replacement for the ‘old’ application virtualization solutions like Microsoft App-V and VMware ThinApp.
While app layering is a good solution for most of the usual issues that come with running many applications on the same machines, it still takes a lot of time to create all those layers.
So together with automation-aficionado Chris Twiest we asked ourselves the question:
Is it possible to automate app layer creation?

This blog will focus on the automation of creating app layers with Citrix App Layering, while Chris Twiest focused on doing the same with VMware App Volumes, the result of which you can find here. This blog is also a precursor to our presentation at the Expert 2 Expert Virtualization Conference in Athens (link).

EDIT Dec 19th 2018: Click here for a YouTube video of the presentation.

App Layering players:
There are currently three main players in the app layering space:
VMware App Volumes (formerly CloudVolumes)
Citrix App Layering (formerly UniDesk)
LiquidWare FlexApp

I am not going to make a detailed comparison of the three. Bas van Kaam already made an excellent blog about it, which definitely is worth a read.

Why are we doing this and how did we get there:
The main goal of this automation-challenge was to see if it actually can be done and not to create a production-ready, fast and, most important of all, vendor-supported solution. This last thing currently is not even possible since neither App Layering, App Volumes nor FlexApp currently offer a SDK of some sort to ‘talk’ to the app layering solution. So we needed to resort to other methods.

Instead of Chris Twiest, who reverse-engineered the App Volumes management page in a very interesting way, I actually had it pretty easy. Ryan Butler already did most of the work for me by creating a PowerShell SDK for Citrix App Layering (link).

The automation process:
So after the usual automation hassle (scripting, testing, bug fixing, rinse and repeat) I ended up with the script below. Although the actual app layer creation was pretty easy, I spent a lot of time installing the application and finalizing the image.
Where the competing products have a dedicated sequencer, Citrix App Layering creates one during app layer creation from the specified OS layer. Since you don’t know the hostname or the IP address of the machine, I used PowerCLI to grab that information from VMware vSphere. If you are using another hypervisor, you would need to edit that part of the script. Luckily, the name of the virtual machine in the hypervisor will have the app layer name in its own display name so you can filter based on that.

When I have the hostname and IP, I can use invoke-command to install the application and run the ‘Shutdown for finalize’ batch file. After that, the script will actually finalize the layer.

The variables and the installation:
Before I will get to the script, I will run through all the variables that you would need to edit to make it work in your environment. I have divided this into two kinds of parameters:
STATIC
Values specific for your environment (probably only edited during setup)
APP LAYER
Values specific for the application layer that you want to create (edited for each app layer)

To get the script running you would need the following things:
– Citrix App Layering appliance
– Citrix App Layering connector to your hypervisor
– OS layer of Windows 7, 8.x or 10 with the firewall disabled and PS remoting enabled (Enable-PSRemoting –Force)
– Management server with PowerCLI installed (assuming you are using vSphere)
– Ryan Butler’s Citrix App Layering PowerShell SDK somewhere on a file-share (optional, it will try to download it first)
– Application installation file somewhere on a file-share (single file installations only currently!)
– Application silent installation parameters

Copy the script to your management server and run through the following variables:

Static variables:
VCServer
Hostname/IP/FQDN of your VMware vCenter server.
ALAppliance
Hostname/IP/FQDN of your Citrix App Layering appliance.
ALUsername
Username of an App Layering administrator.
ALPassword
Password of the same App Layering administrator.
ALSDKLocation
Location of the (downloaded) Citrix App Layering PowerShell SDK.
BuildVMUsername
Username of an administrator in the OS layer/sequencer.
BuildVMPassword
Password of the OS layer administrator.
LocalTempFolderName
Name of the folder that will be used as temporary location for the application installer.
PSDriveLetter
Drive letter that will be used to connect to the local disk of the sequencer.
ALConnectorName
Name of the hypervisor connector in Citrix App Layering.
ALOSLayerName
Name of the OS layer that you would like to use.

App layer variables:
ALAppLayerName
Name of the app layer that you would like to create.
ALAppLayerDescription
Description of the application that you are installing.
AppInstallerLocation
Location of application installer file.
AppInstallerFile
Name of application installer file. (MSI or EXE, if MSI then misexec.exe /I command will automatically be added)
AppInstallParameters
Silent installation parameters for the application.

After filling out all these variables, you are ready to run the script. Now keep in mind that Citrix App Layering is not the fastest solution in the world, so the script will run for a while. I am also using a lot of ‘Start-Sleep’-commands that I don’t really like and might break the script when your environment is too slow.
When I find the time, I will look into refining this by waiting for specific results. But for now: feel free to improve it where needed. 😉

The actual script:

DISCLAIMER: Once again: I’m in no way an expert PowerShell scripter, so it might not be the most efficient code, but it gets the job done. And, of course, feel free to use it/alter it/publish it as your own.

12,286 total views, 128 views today

1 thought on “Automating the Citrix App Layer

Leave a Reply

Your email address will not be published. Required fields are marked *