Jump to content
XPEnology Community

[Script+Tips] XenServer scripts and tips

Recommended Posts

XenServer mangement tool - XenCenter - will no longer allow point and click install of updates to a XenServer (unless a Citrix license is purchased) as of XenServer 6.2. Updates have to be installed manually, through the command line.

XenServer: Powershell Script to install Updates


$server = "NameofXenServerorIP" # <---Modify this to suit your needs
$updatepath = "\\NetworkShare\Share1\XenUpdates\Stage 1" # <---Modify this to suit your needs

$SecureString = read-host “Enter root-password” -asSecureString
$password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($secureString))

foreach ($update in Get-ChildItem $updatepath)
$UpdateName = $update.basename

Write-Host "Uploading $UpdateName" -Fore White
. 'C:\Program Files (x86)\Citrix\XenCenter\xe.exe' patch-upload -s $server -u root -pw $password file-name=$updatepath\$update | out-file $server"_uuid.txt"
$uuid_patch = get-content .\$server"_uuid.txt"

If ($uuid_patch -like "exists") {
$uuid_patch = $uuid_patch.split()[-1]
Write-Host "$UpdateName had been uploaded in the past, will attempt to install again" -Fore Yellow
Write-Host "--- UUID obtained: $uuid_patch" -Fore White
else {
Write-Host "--- UUID obtained: $uuid_patch" -Fore White

Write-Host "Attempting to patch XenServer $server with $UpdateName ...." -Fore White
. 'C:\Program Files (x86)\Citrix\XenCenter\xe.exe' -s $server -u root -pw $password patch-pool-apply uuid=$uuid_patch

#Write-Host "--- Checking if $UpdateName applied successfully to $server" -Fore White
#. 'C:\Program Files (x86)\Citrix\XenCenter\xe.exe' -s $server -u root -pw $password patch-list name-label=$UpdateName 



Note: The "Stage 1" folder is what I used for things like installing XenServer 6.2 SP1 first. Then I rebooted the box and ran "Stage 2" folder which had all the other updates (including the post SP1 updates). Rebooted after that. Works decently enough it seems.



Edited by Guest
Link to comment
Share on other sites

In XenServer versions 6.x, the direct GUI ability to auto-start a Virtual Machine on the startup of XenServer was removed. The auto-start functionality was removed because it interfered with High Availability (HA) and produced unexpected results during HA functions.

XenServer: Autostart VMs

[spoiler=][u]Unlock functionality on the Pool Level[/u]

1. Get Pool List:

xe pool-list

2. Unlock Autostart on specific pool:

xe pool-param-set uuid=xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx other-config:auto_poweron=true 


Enable for VM

1. Get list of VMs:

xe vm-list

2. Enable for specific VM:

xe vm-param-set uuid=xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx other-config:auto_poweron=true


Source: http://support.citrix.com/article/CTX133910

Edited by Guest
Link to comment
Share on other sites

  • Create New...