In one of my last blog post I wrote about the different ways to use Mirage app layers to deploy applications. I also introduced a new way to deploy application installers using application layers.
Currently there are two types of applications which can not be deployed using a Horizon Mirage application layer: apps which create users and/or groups during the installation and also applications which modify the local disk like some disk encryption software does.
Still you may want to use Mirage application layers because you may not have another ESD solution or you also want to use all the compression, deduplication and branch reflector functionalities for the deployment and installation of native application installers.
Now I will show you how to deploy an application installer using application layers and how you automate the installation using post-application layer deployment scripts. I will use VMware Player as an example.
I assume that you already have practice in creating and deploying application layers using Mirage and therefore an application layer reference machine is available. If this is not the case please have a look at my article on how Horizon Mirage application layering works.
First you have to start the recording progress for a new application. During the recording process you have to copy the installation source files of the application you want to install to the application layer reference machine. I normally use a location under the Program files directory, something like
In my example the variable %AppLayerName%; is replaced by VMwarePlayer6. So I copy the VMware Player installation executable inside this directory.
After that I create a new post-application layer deployment script. For each application layer the script needs to have a unique name using the format “post_layer_update_*.bat”. The asterisk needs to be replaced with an unique value. I recommend to use the application name for identification and a random number at the end.
For example: post_layer_update_vmwareplayer6_7716.bat
The script has to be placed inside the directory “%ProgramData%WanovaMirage Service”.
The following command line creates a unique post-script in the correct directory and automatically opens it up using Notepad.
notepad.exe "%ProgramData%\Wanova\Mirage Service\post_layer_update_AppName_%random%.bat
Please make sure to replace “AppName” with the name of the application you want to install and to run the command as administrator.
After the script is created and Notepad is opened up you have to add two things: (1) the command line to install the application silently and (2) optionally a command to delete the installation source files after the installation to save local disk space.
For my example I created the following post-app layer script:
start /wait "Installing VMware Player" "%ProgramFiles%\MirageAppLayerDeployment\VMwarePlayer6\VMware-player-6.0.1-1379776.exe" /s /v EULAS_AGREED=1 COMPONENTDOWNLOAD=0 SIMPLIFIEDUI=1 ADDLOCAL=ALL AUTOSOFTWAREUPDATE=0 DESKTOP_SHORTCUT=0 QUICKLAUNCH_SHORTCUT=0 rd /s "%ProgramFiles%\MirageAppLayerDeployment\VMwarePlayer6"
Of course this script can contain everything you want. You could also run a PowerShell script or something else. One thing you need to keep in mind is that the script is running under the local system account. So user specific changes (HKCU, %AppData%, etc) will no arrive at the locally logged on user but for the local system account.
After you copied the installation sources files to the corresponding directory and created the script file you can finish the application layer.
Now, when you assign the application layer to a managed device the following will happen:
- The installation source files and the post-application layer deployment script will be downloaded to the client.
- A reboot is required to apply the application layer.
- After the reboot is done the post-layer script will run and install the application.
As you can see the installation is not directly done when the application layer is downloaded but after the application layer is applied (after the reboot/pivot phase). Another gotcha to be aware of is when the application layer is removed the application will not be uninstalled. An application layer can only remove files and registry keys which are included in the layer itself, nothing else. So when you remove the layer only the installation source files will be remove but not the application installed by the post-layer script.
If you also want to use application layers to remove applications installed this way just create an uninstall application layer. This layer contains nothing more than post-layer script which silently runs the uninstallation for your specific application.