XenServer VM Export Script on Powershell

Hi all,

I was unable to find an existing script which does simply export all user created VMs and templates to xva files named like the VM.
It uses the commandline executable of XenCenter as I’m not able to install the PowerShell Extension everywhere

Powershell VM-Export

Hint: If you want to increase data throughput, convert compress=true to false at costs of your storage

# XenServer VM-Export
# Author: Mauricio Schäpers
# Description: Exports all vms into a given directory

$xeserver = ""
$xeuser = "root"
$xepw = "s3cr3tP@55w0rd"
$xvadir = "D:\ExportFolder"

#Check where xencenter is installed
$xecmd = "c:\program files (x86)\citrix\xencenter\xe.exe"
if (!(Test-Path $xecmd)) { $xecmd = "c:\program files\citrix\xencenter\xe.exe"}