Free XenServer VM’s Backup Tool and PowerShell Script!

Recently I wrote a blog about XenServer and Powershell commands this blog was also published on the Citrix Blog site here. With those commands in hand I wanted to create something that can be used by everyone who uses Citrix XenServer. To mind came a PowerShell VM Backup Script (invoke-XenBackup) and a PowerShell Forms GUI tool to also schedule your Backup of XenServer VM’s. The tool has the following functions:

  • Create a backup folder with date.
  • Take a snapshot of a running or stopped VM.
  • Export the snapshot to a XVA file.
  • Optionally Zip the backup folder.
  • Optionally Email backup log.
  • Shedule a backup as a Windows Scheduled Task.
  • Run and delete scheduled backup tasks.
  • Saves your XenServer Password in a Encrypted Vault.

Download the Workspace-Guru XenServer Backup Tool.

System requirement’s:

Video tutorial

Powershell Script

The heart of the tool is a PowerShell script I created named invoke-XenBackup. The script does require the XenServer PowerShell module installed. The GUI Tool will do this automatically. To do this manually download the PowerShell module here under the development section. And extract it to your PowerShell Module folder.

Example how to use the script:

Invoke-XenBackup -ExportPath “C:\Backup” -VMnames “VM01″,”VM02″,”VM03” -username “root” -password “P@ssw0rd” -XenHost “XenHost01” -LogPath “C:\Temp” -Email -SMTPServer “smtp.domain.com” -FromEmail “backup@domain.com” -ToEmail “sysadmin@domain.com” -ZIP

This will backup VM01, VM02 and VM03 from XenHost01 in C:\Backup. Username and Password are for XenHost01. After the backup the folder will be ZIP’d and the backup logfile will be send in a email to sysadmin@domain.com

Download the script as a RES / Ivanti Automation Building Block from the RES HUB.

I hope this was informative. For questions or comments you can always give a reaction in the comment section or contact me:

Share

6 thoughts on “Free XenServer VM’s Backup Tool and PowerShell Script!

  1. Excellent work Chris!

    When importing a backed up VM it is restored as a template, what in most cases is not wanted. This can be avoided by setting the following parameters, at line 133, before exporting the snapshot .

    Set-XenVM -Uuid $SnapshotUuid -IsATemplate $false -HaAlwaysRun $false

  2. Hello ,,,I am really new at this, do not even know how to write a script on any language, but I am really thankful I found this website. I have tried the backup tool on my server, I see the zip logs on the folder I want to send them to but I do not know where that actual snapshot went to . I do not see it under snapshots at the VM selected. Please excuse my ignorance. What am I not seeing or what am I doing wrong.

    1. Hi Frank,

      Cool that you found the tool! The tool will copy the snapshot to the export path you selected after that it will delete the snapshot. You can send the logs to Chris.twiest@dtncomputers.nl. That way I can help some more.

Leave a Reply

Your email address will not be published. Required fields are marked *