Citrix XenServer 6.5 Service Pack 1 was released at the first day of Citrix Synergy 2015. So back in the lab I upgraded my XenServer.
Upgrading the hypervisor is the easy part, upgrading XenServer Tools on all your VM’s are the hard and time consuming part. So let fix that!
In my last blog post Automation and Optimization I showed you my new PowerShell Wrapper. The follwing script will install XenServer Tools unattended with extensive logging. You can run it as is, but it’s very time consuming on hundreds of VM’s!
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 = "XenServer" $PackageName = "installwizard" $InstallerType = "msi" $Version = "6.5 FP1" $LogPS = "C:\Windows\Temp\$Product $Version PS Wrapper.log" $LogApp = "C:\Windows\Temp\XS65FP1.log" $Destination="${env:ChocoRepository}" + "\$Vendor\$Product\$Version\" $UnattendedArgs = "/i $PackageName.$InstallerType ALLUSERS=1 /Lv $LogApp /quiet /norestart" 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 |
This is an excellent use case for Chocolatey and Boxstarter. Let’s use that to Automatically Update Citrix XenServer Tools on all of our VM’s.
The normal Chocolatey behaviour is to copy the EXE or MSI file locally and then install it. Since we need to extracted the rather incredible stupid XenServer Tools to do an unattended install, we need to change a couple of lines.
So what we need to do is to change the working directory to $Destination and then call MSIEXEC with the arguments directly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
$Vendor = "Citrix" $Product = "XenServer" $PackageName = "installwizard" $InstallerType = "msi" $Version = "6.5 FP1" $LogPS = "C:\Windows\Temp\$Product $Version PS Wrapper.log" $LogApp = "C:\Windows\Temp\XS65FP1.log" $Destination="${env:ChocoRepository}" + "\$Vendor\$Product\$Version\" $UnattendedArgs = "/i $PackageName.$InstallerType ALLUSERS=1 /Lv $LogApp /quiet /norestart" CD $Destination try { (Start-Process msiexec.exe -ArgumentList $UnattendedArgs -Wait -Passthru).ExitCode Write-ChocolateySuccess "$packageName" } catch { Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)" throw } |
As always make sure to test the NUPKG package locally on your Boxstarter launcher machine to make sure everything is okay before pushing it out. Learn all about it here Getting Started with Chocolatey and Boxstarter.
Let’s pipe in the VM’s, I guess you can use a CSV as well, but didn’t have time to test it.
1 2 |
$cred = get-credentials ctxlab\administrator $result = "bs-02","gw-01","mdt-01","sei-01" | Install-BoxStarterPackage -Packagename XenServer_Tools -Credentials $cred |
So as you might have figured out, you can use Chocolatey to install or upgrade whatever you want on hundreds of machines in a single command line.
Hi,
thanks its very useful. you are brilliant. can you pls send me the url of xs tolls 6.5. can you please please upload the xs tolls on 4shared.com or some where else and email me the link. i will be very thankful to you.
[email protected]
Hi, just can download the XenServer Tools here: http://xenserver.org/