In my last post Ultimate Guide to Citrix Lifecycle Management I covered the basics of custom scripts and blueprints to get you started.
Now let’s dive a little bit deeper with some great examples on monitoring. There’s already a LoginVSI blueprint, but let’s add Splunk, uberAgent and ControlUp to the mix.
Since Splunk doesn’t have a direct download URL I’m hosting the media in my Amazon S3 bucket. The script below can be customized to connect to a private FTP server instead. Change $URL on line 13 to point to your media repository.
Install Splunk Enterprise
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 |
Write-Verbose "Setting Arguments" -Verbose $startDTM = (Get-Date) $Vendor = "Splunk" $Product = "Enterprise" $PackageName = "splunk-6.2.5-272645-x64-release" $InstallerType = "msi" $Version = "6.2.5" $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 AGREETOLICENSE=Yes /qn /liewa $LogApp" $url = "http://xxxxxx.s3.amazonaws.com/splunk-6.2.5-272645-x64-release.msi" $output = "$env:SystemDrive\Installers\$Vendor\$Product\$Version\$PackageName.$InstallerType" Start-Transcript $LogPS if (-not (Test-Path $env:SystemDrive\Installers\$Vendor\$Product\$Version\$PackageName.$InstallerType)) { 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 |
Since the ControlUp and uberAgent download is in a ZIP format you’ll need to install 7Zip prior so it can be extracted by the script.
Install 7Zip (x64)
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 |
Write-Verbose "Setting Arguments" -Verbose $startDTM = (Get-Date) $Vendor = "Misc" $Product = "7Zip" $Version = "9.38" $PackageName = "7z938-x64" $InstallerType = "msi" $LogPS = "${env:SystemRoot}" + "\Temp\$Vendor $Product $Version PS Wrapper.log" $LogApp = "${env:SystemRoot}" + "\Temp\$PackageName.log" $UnattendedArgs = "/i $PackageName.$InstallerType ALLUSERS=1 /qn /liewa $LogApp" $url = "http://www.7-zip.org/a/7z938-x64.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 |
Install ControlUp
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 52 53 54 55 56 57 |
Write-Verbose "Setting Arguments" -Verbose $startDTM = (Get-Date) $Vendor = "Misc" $Product = "ControlUp" $PackageName = "ControlUpConsole" $Version = "4.1" $InstallerType = "exe" $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='/sAll /msi /norestart /quiet ALLUSERS=1 EULA_ACCEPT=YES' $url = "https://ctrlupfeeu01.controlup.com/Downloads/ControlUpConsole.zip" $output = "$env:SystemDrive\Installers\$Vendor\$Product\$Version\ControlUp.zip" 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) $file_dir = "$env:SystemDrive\Installers\$Vendor\$Product\$Version" $file_name = "ControlUp.zip" $file = Join-Path -Path $file_dir -ChildPath $file_name #Locate 7Zip Executable $zipPath = "C:\Program Files\7-Zip\7z.exe" #Set Alias for 7Zip Set-Alias zip $zipPath ls alias:zip zip x "-o$file_dir" $file start-sleep -s 10 } 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 "$PackageName.$InstallerType" $UnattendedArgs -Wait -Passthru).ExitCode Write-Verbose "Customization" -Verbose New-Item -Path $env:ProgramFiles\Smart-X\ControlUp -ItemType Directory -Force | Out-Null copy-item ControlUpConsole.exe -Destination $env:ProgramFiles\Smart-X\ControlUp\ControlUpConsole.exe -Recurse # Create a Shortcut with Windows PowerShell $TargetFile = "$env:ProgramFiles\Smart-X\ControlUp\ControlUpConsole.exe" $ShortcutFile = "$env:Public\Desktop\ControlUpConsole.lnk" $WScriptShell = New-Object -ComObject WScript.Shell $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile) $Shortcut.TargetPath = $TargetFile $Shortcut.Save() 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 |
Install uberAgent
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 |
Write-Verbose "Setting Arguments" -Verbose $startDTM = (Get-Date) $Vendor = "Misc" $Product = "uberAgent" $PackageName = "uberAgent-64" $InstallerType = "msi" $Version = "3.1.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 = "https://uberagent.com/downloads/uberAgent/current/uberAgent.zip" $output = "$env:SystemDrive\Installers\$Vendor\$Product\$Version\uberAgent.zip" 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) $file_dir = "$env:SystemDrive\Installers\$Vendor\$Product\$Version" $file_name = "uberAgent.zip" $file = Join-Path -Path $file_dir -ChildPath $file_name #Locate 7Zip Executable $zipPath = "C:\Program Files\7-Zip\7z.exe" #Set Alias for 7Zip Set-Alias zip $zipPath ls alias:zip zip x "-o$file_dir" $file start-sleep -s 10 } else {Write-Verbose "$Vendor $Product $Version Exist" -Verbose} CD "$env:SystemDrive\Installers\$Vendor\$Product\$Version\uberAgent components\uberAgent_endpoint\bin\" 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 |
Next step is to add these scripts to your custom blueprint and deploy.
Splunk and ControlUp goes to your Delivery Controller and uberAgent to your VDA’s.
It’s really amazing launching the deployment from the cloud and watching VM’s pop up automatically in your private or public cloud.
When the blueprint deployment is running, you can even see the verbose results in the Step Output.
Final step is to configure Splunk and uberAgent. The last one now has it’s own Group Policy so that’s peace of cake. Check this KB for more details Configuration Through Group Policy.
A feature of Citrix Lifecycle Management that many might have missed is the alerts and monitoring section which are really smooth.
Hope this post gave you some more insight and ideas to create your own scripts and blueprints.
A final tip is to create a email filter for the Citrix Lifecycle Management notifications and use the Tear Down feature of the Blueprint to delete and cleanup.