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.
- Minimal Windows 7 or 2008R2
- PowerShell V3 (for win7 and 2008R2 please install: https://www.microsoft.com/en-us/download/details.aspx?id=34595
- Backup sheduling only works on windows 2012 / or 8 and up
- Tool is tested with XenServer 6.5 , 7.x
- “Set-ExecutionPolicy Unrestricted” must be set.
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 “email@example.com” -ToEmail “firstname.lastname@example.org” -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 email@example.com
I hope this was informative. For questions or comments you can always give a reaction in the comment section or contact me: