As network engineers and technicians, we often rely on Wireshark to troubleshoot and analyze network…
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
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 = "192.168.0.1s" $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"} #Get the UUIDs of all powered-off machines $colvmuuids = (& $xecmd -s $xeserver -u $xeuser -pw $xepw vm-list is-control-domain=false power-state=halted params=uuid --minimal) -split "," foreach ($vmuuid in $colvmuuids){ #Get the name label for filenameing $vmnamelabel = & $xecmd -s $xeserver -u $xeuser -pw $xepw vm-list uuid=$vmuuid params=name-label --minimal Write-Host ############## Write-Host Starting $vmnamelabel & $xecmd -s $xeserver -u $xeuser -pw $xepw vm-export uuid=$vmuuid compress=true filename=$xvadir"\"$vmnamelabel".xva" Write-Host Finished! } #Get the UUIDs of all user generated templates $coltemplateuuids = & $xecmd -s $xeserver -u $xeuser -pw $xepw template-list live=true foreach ($templateuuid in $coltemplateuuids){ #Get the name label for filenameing $templatelabel = & $xecmd -s $xeserver -u $xeuser -pw $xepw vm-list uuid=$vmuuid params=name-label --minimal Write-Host ############## Write-Host Starting $templatelabel & $xecmd -s $xeserver -u $xeuser -pw $xepw vm-export uuid=$vmuuid compress=true filename=$xvadir"\Template_"$vmnamelabel".xva" Write-Host Finished! } Write-Host -ForegroundColor Yellow "All Jobs completed!"
Dieser Beitrag hat 0 Kommentare