Citrix Lifecycle Management (CLM) is a cloud based Automation Framework that you can leverage to build and scale up & down your environment in any cloud. Think of it as Powershell remoting, just extremely more powerful.
If you can do it with Powershell, you can do it with Citrix Lifecycle Management.
To get started you’ll need to prepare a VM template that contains VM tools, latestest Windows Updates and some firewall modifications. Check this documentation for the complete details and sample files Prepare Windows Server VM templates for deploying blueprints.
I’m using my Automation Framework to build the template and install the correct Hypervisor tools.
Before you convert the VM to a template you’ll need to Sysprep it. Make sure the unattend.xml is located locally and modified with your password.
1 |
Sysprep /generalize /oobe /shutdown /unattend:c:\unattend.xml |
Now with the VM template ready you’ll need to setup a server which has Citrix Lifecycle Management Agent installed. This is the server which takes care of the communication between the control plane and your cloud.
If you’re going to use Amazon or Azure you don’t need a VM template nor a server with the CLM Agent installed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
Write-Verbose "Setting Arguments" -Verbose $startDTM = (Get-Date) $Vendor = "Citrix" $Product = "Lifecycle Management Agent" $PackageName = "CitrixLifeCycleManagementAgent" $InstallerType = "msi" $Version = "2.5.0" $LogPS = "${env:SystemRoot}" + "\Temp\$Vendor $Product $Version PS Wrapper.log" $LogApp = "${env:SystemRoot}" + "\Temp\$PackageName.log" $Destination = "${env:ChocoRepository}" + "\$Vendor\$Product\$Version\$packageName.$installerType" $UnattendedArgs = "/i $PackageName.$InstallerType ALLUSERS=1 REBOOT=R /qn /liewa $LogApp" Start-Transcript $LogPS CD $Version Write-Verbose "Starting Installation of $Vendor $Product $Version" -Verbose (Start-Process msiexec.exe -ArgumentList $UnattendedArgs -Wait -Passthru).ExitCode Write-Verbose "Customization" -Verbose Write-Verbose "Stop logging" -Verbose $EndDTM = (Get-Date) Write-Verbose "Elapsed Time: $(($EndDTM-$StartDTM).TotalSeconds) Seconds" -Verbose Write-Verbose "Elapsed Time: $(($EndDTM-$StartDTM).TotalMinutes) Minutes" -Verbose Stop-Transcript |
From CLM you’ll need to configure your Resource Location, that being your Hypervisor(s).
George Kuruvilla has already created an excellent step-by-step blog post on how to deploy blueprints – Citrix Lifecycle Management: A step by step walk through of an automated deployment on ANY cloud! Check it out for more in depth details.
There’s a couple of Blueprints in the CLM Blueprint Catalog, but what’s a PoC without any applications?
So let’s fix that, meet Custom Scripts. My plan was to use Chocolatey to install applications, but that didn’t work out (too high failrate), so I created my own.
The script below is very powerfull and you can use it to install private software as well.
Add your script.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# PowerShell Wrapper for MDT, Standalone, Chocolatey and LifeCycle Management - (C)2015 xenappblog.com # Example 1: Start-Process "XenDesktopServerSetup.exe" -ArgumentList $unattendedArgs -Wait -Passthru # Example 2 Powershell: Start-Process powershell.exe -ExecutionPolicy bypass -file $Destination # Example 3 EXE (Always use ' '): # $UnattendedArgs='/qn' # (Start-Process "$PackageName.$InstallerType" $UnattendedArgs -Wait -Passthru).ExitCode # Example 4 MSI (Always use " "): # $UnattendedArgs = "/i $PackageName.$InstallerType ALLUSERS=1 /qn /liewa $LogApp" # (Start-Process msiexec.exe -ArgumentList $UnattendedArgs -Wait -Passthru).ExitCode Write-Verbose "Setting Arguments" -Verbose $startDTM = (Get-Date) $Vendor = "Misc" $Product = "Libre Office" $PackageName = "LibreOffice_5.0.0_Win_x86" $InstallerType = "msi" $Version = "5.0.0" $LogPS = "${env:SystemRoot}" + "\Temp\$Vendor $Product $Version PS Wrapper.log" $LogApp = "${env:SystemRoot}" + "\Temp\$PackageName.log" $Destination = "${env:ChocoRepository}" + "\$Vendor\$Product\$Version\$packageName.$installerType" $UnattendedArgs = "/i $PackageName.$InstallerType ALLUSERS=1 /qn /liewa $LogApp" $url = "http://download.documentfoundation.org/libreoffice/stable/5.0.0/win/x86/LibreOffice_5.0.0_Win_x86.msi" $output = "$env:SystemDrive\Installers\$Vendor\$Product\$Version\$PackageName.$InstallerType" Start-Transcript $LogPS if (-not (Test-Path $env:SystemDrive\Installers\$Vendor\$Product\$Version)) { Write-Verbose "Starting Download of $Vendor $Product $Version" -Verbose New-Item -Path $env:SystemDrive\Installers\$Vendor\$Product\$Version -ItemType Directory | Out-Null $wc = New-Object System.Net.WebClient $wc.DownloadFile($url, $output) } else {Write-Verbose "$Vendor $Product $Version Exist" -Verbose} CD $env:SystemDrive\Installers\$Vendor\$Product\$Version Write-Verbose "Starting Installation of $Vendor $Product $Version" -Verbose (Start-Process msiexec.exe -ArgumentList $UnattendedArgs -Wait -Passthru).ExitCode Write-Verbose "Customization" -Verbose Write-Verbose "Stop logging" -Verbose $EndDTM = (Get-Date) Write-Verbose "Elapsed Time: $(($EndDTM-$StartDTM).TotalSeconds) Seconds" -Verbose Write-Verbose "Elapsed Time: $(($EndDTM-$StartDTM).TotalMinutes) Minutes" -Verbose Stop-Transcript |
The script above will check if the file exists, and if not automatically download from internet before installation.
What’s awesome about Citrix Lifecycle Management is that you can pass parameters to your scripts. So instead of downloading all the media from the internet, you could point to a local share instead when deploying the Blueprint.
Here’s an overview of my Private Script Library.
You can deploy scripts as manual jobs.
Or you can deploy them as part of your custom Blueprint.
Troubleshooting could be hard, but luckily my code has extensive logging.
Citrix Lifecycle Manangement is extremly powerful and fleixble. During the weekend I worked a couple of hours on my laptop with a 3G connection, deploying blueprints to both public and private clouds.
CLM won’t replace your OSD solution anytime soon, at least not in a hybrid public / private cloud combo. So you’ll still need a Autmation Framework.
For only $97 you’ll get instant access and lifetime updates to my Automation Framework. Watch out for advanced custom Blueprints and Scripts powered by xenapptraining.com.