Ultimate Guide to Citrix Lifecycle Management

An article by Trond Eirik Haavarstein from xenappblog

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.

Ultimate Guide to Citrix Lifecycle Management 16

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.

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.

Ultimate Guide to Citrix Lifecycle Management 17

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 beeing your Hypervisor(s).

Ultimate Guide to Citrix Lifecycle Management 01

Ultimate Guide to Citrix Lifecycle Management 02

Ultimate Guide to Citrix Lifecycle Management 03

Ultimate Guide to Citrix Lifecycle Management 04

Ultimate Guide to Citrix Lifecycle Management 05

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 own.

The script below is very powerfull and you can use it to install private software as well.

Ultimate Guide to Citrix Lifecycle Management 10

Add your script.

Ultimate Guide to Citrix Lifecycle Management 11

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:SystemDriveInstallers$Vendor$Product$Version$PackageName.$InstallerType"

Start-Transcript $LogPS

	if (-not (Test-Path $env:SystemDriveInstallers$Vendor$Product$Version)) {
        Write-Verbose "Starting Download of $Vendor $Product $Version" -Verbose 
		New-Item -Path $env:SystemDriveInstallers$Vendor$Product$Version -ItemType Directory | Out-Null
		$wc = New-Object System.Net.WebClient
		$wc.DownloadFile($url, $output)
		}

CD $env:SystemDriveInstallers$Vendor$Product$Version

Write-Verbose "Starting Installation of $Vendor $Product $Version" -Verbose 
(Start-Process "$PackageName.$InstallerType" $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 it will automatically download it from internet.

What’s awesome with Citrix Lifecycle Management is that you can pass parameters to your scripts.

Ultimate Guide to Citrix Lifecycle Management 12

So instead of downloading all the media from the internet, you could point to a local share instead.

Ultimate Guide to Citrix Lifecycle Management 07

You can deploy scripts as manual jobs.

Ultimate Guide to Citrix Lifecycle Management 13

Ultimate Guide to Citrix Lifecycle Management 14

Or you can deploy them as part of your custom blueprint.

Ultimate Guide to Citrix Lifecycle Management 06

Troubleshooting could be hard, but luckily my code has extensive logging.

Ultimate Guide to Citrix Lifecycle Management 15

Citrix Lifecycle Manangement is extremly powerful and fleixble. During this weekend I worked a couple of hours on my laptop with a 3G connection, deploying to blueprints to both public and private clouds.

CLM won’t replace your OSD solution anytime soon, atleast 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. Watch out for custom Blueprints and Scripts powered by xenapptraining.com.

Automation Framework 03

 

Be Sociable, Share!
 

Tags: ,

Comments

No comments so far.

  • Leave a Reply
     
    Your gravatar
    Your Name