Free XenServer VM’s Backup Tool and PowerShell Script!
Help me update and support the tool by donating with PayPal.
Download Version 2.0
Now also available on Chocolatey
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.
Changelog V2.0:
- Now support for network drives, enter a path like \\DOMAIN\Share at Enter backup path and the tool will mount the drive. The task user does need to have write permissions on the share.
- Temp issue fixed, the tmp file created by the export will now be written to the backup destination instead of C drive.
- GUI hangs on run now backup is fixed, run now backups will now be set as a windows task that runs directly. You can manage your RUN NOW tasks in the scheduled tasks window.
- Performance improvements.
Download Version 2.0
System requirement’s:
- 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.
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
There is now also a multi-threaded version of the script thanks to Bill Rogge. The script uses 6 threads by default but you change that under thread count.
I hope this was informative. For questions or comments you can always give a reaction in the comment section or contact me:
Can configure this script to backup vm’s only for last 2 weeks ?
You could disable the script in your windows task scheduler after two weeks.
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
Nice tip thank you!
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.
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.
Hi Frank, you can download Version 2 of the tool today. Version 2 has fixed the temp issue which you experienced.
Hi Chris,
I’ve been having issues when backing up my XenServer VMs. Your software issued to work fine but it stopped with no reason. I create a task with it but it does not run it and i don’t know where to find the logs.
Any help would be appreciated.
Thanks
Hi David,
You can find the logs at “C:\ProgramData\Workspace-Guru\XenServer-Backup”.
If you open the application and try a new backup with “Run Backup NOW” you will get the most info in the log.
Hope this helps you can always send me the logs: Chris.twiest@dtncomputers.nl
Thanks.
Does the software copy the VMs to local PC and then to the NAS (if using?).
I noticed that the VM responsible for the backups loosing the storage space when the backup used to started.
The software exports the snapshots (backups) to the backup path. This must be a local storage to the vm so it can be iscsi lun etc.
Hi Chris,
It would be good to add the feature of exporting VMs directly to a network path. May this be NAS or any sort. Export to external drive could be a plus too.
Your software is a very good, and free. It could even be used in a corporate place.
Thank you and a Version 2 of the tool is in the making with network drive support. And maybe some more features;)
Hi Davidson, thank you for your patience, Version 2 is out today and should solve your problems. I also added the ability to backup to network drives directly! But the user running the task must have writing writes to the share. I hope this works for you!
Thanks Chris.
Do you have an ETA of v2 of the software?
happy to be on your beta list.
I think around november. And I will keep you in mind!
It’s finialy out today, sorry for the delays.
I get the following error on backup and I don’t see script folder being populated with .ps1 files of program data\workspace-guru\xenserver backup in my lab testing and I am authenticating to pool-master –
The property ‘Pool’ cannot be found on this object. Verify that the property
exists and can be set.
At line:1025 char:5
+ $Pools.Pool = $PoolMaster
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
0
1
2
3
4
5
Directory: C:\ProgramData\Workspace-Guru\XenServer-Backup
Mode LastWriteTime Length Name
—- ————- —— —-
d—– 8/6/2018 11:31 AM Backup_Logs
Directory: C:\ProgramData\Workspace-Guru\XenServer-Backup\Backup_Logs
Mode LastWriteTime Length Name
—- ————- —— —-
-a—- 8/6/2018 11:31 AM 0 XenBackupLog_2018-06-08-11-31-
17.txt
2018-06-08-11-31-17 — Start Backup
Directory: E:\backup
Mode LastWriteTime Length Name
—- ————- —— —-
d—– 8/6/2018 11:31 AM XenBackup-2018-08-06
Directory: E:\backup\XenBackup-2018-08-06
Mode LastWriteTime Length Name
—- ————- —— —-
d—– 8/6/2018 11:31 AM lab-app-srv
Export-XenVm : There is not enough space on the disk.
At line:764 char:5
+ … Export-XenVm -Uuid $SnapshotUuid.uuid -XenHost “$XenHost” …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Export-XenVm], IOException
+ FullyQualifiedErrorId : System.IO.IOException,Citrix.XenServer.Commands.
ExportXenVmCommand
Directory: C:\ProgramData\Workspace-Guru\XenServer-Backup\Backup_Logs
Mode LastWriteTime Length Name
—- ————- —— —-
-a—- 8/6/2018 11:44 AM 0 XenBackupLog_2018-06-08-11-44-
05.txt
2018-06-08-11-44-06 — Start Backup
Directory: E:\backup
Mode LastWriteTime Length Name
—- ————- —— —-
d—– 8/6/2018 11:44 AM XenBackup-2018-08-06
Directory: E:\backup\XenBackup-2018-08-06
Mode LastWriteTime Length Name
—- ————- —— —-
d—– 8/6/2018 11:44 AM lab-app-srv
Hello Prasant,
You can ignor the pool error. The backup fails because: Export-XenVm : There is not enough space on the disk. I don’t know why you won’t get a script in the folder did you schedule the task correctly with enough rights?
Hi Parasant, you can download Version 2 of the tool today. Version 2 has fixed the temp issue which you experienced.
Chris… I am using run backup now before trying the schedule. I assigned full permission on user account I am logged in with and modify access to everyone for test and still failing
Hi Prasamt, did you check your storage space. That was the issue in your last log?
If you still have issue please email me the log to chris.twiest@dtncomputers.nl and we will continue through email.
Chris,
First off, thank you for doing all of the leg work in putting this together. I’m having a similar issue to Prasamt; I’m running out of disk space. In monitoring the process, it looks like I’m running out of drive space on my C:\ drive on the VM where the script is running. I’ve specified another drive (E: in this case) for the backup destination and for the logging. It seems as if the backup gets written to C: and then copied to E; small VM’s backup with no issue, whereas larger ones fail when C: runs out of space.
Are there default locations that Citrix XenServer Powershell uses for temp or operating locations?
Any help would be appreciated.
Thanks again!
Thank you for figuring that out! I will have to look in to that. I’m busy with v2 of the tool. Will take a look at this!!
I found the issue. It is with PowerShell in general, not necessarily your script. If you change the environmental variable ($env:TMP) to a location with sufficient space everything works as expected. The default location is:
C:\Users\%username%\AppData\Local\Temp
In my specific case, I added a two statements just before the Invoke-XenBackup command in the ps1 file for the job:
$env:TMP = “E:\TEMP”
$env:TEMP = “E:\TEMP”
This forces PowerShell to use E:\TEMP as the temp location to copy the snapshot prior to writing to the location specified in your script. Using this location, I had ample free space to backup all of the VM’s in my pool.
Awesome thank you for checking it out and I will do this in v2!
I used the tool and all looked well only when I start the backup it creates the folders but doesn’t save any files (just an empty folder with the name of the backup that’s all)
I must be doing something wrong but not sure what. Could this also be because of the temp location?
Windows Server 2012 R2 and Xen 6.5
Thanks in advanced and thanks for creating this tool, its exactly what Xen Server is missing.
Hi James,
It could be temp folder issue. Please check the logs C:\ProgramData\Workspace-Guru\XenServer-Backup. I’m hard at work with a version 2 will be released end of November/ start December 2018
Thanks for your reply, I’ll check that folder tonight!
Can’t wait for version 2 🙂
Version 2 is out today and has the temp issue fixed !
After one week of backup, my Xen’s local storage is full with vm’s snapshots but normally local must be deleted by the script. It’ s a bug or not.
What I’m doing wrong ?
Thank’s
They should be deleted. Can you check out the log in C:\ProgramData\Workspace-Guru\XenServer-Backup and do you get a backup log?
Hello,
I am currently using your VM backup software to export to an external hard drive. I have xenserver 6.5 and 7.2
I’m having export problems I do not have logs to find out why.
Example:
Backuklog
2018-02-11-03-10-57 — Start Backup for UTI-COMPTA-SAGE to F: \ VIRTUAL2
2018-02-11-03-10-58 — Create Snapshot UTI-COMPTA-SAGE
2018-02-11-03-11-05 — Export Snapshot UTI-COMPTA-SAGE
2018-02-11-03-27-14 — ERROR —- Export Snapshot UTI-COMPTA-SAGE failed
2018-02-11-03-27-14 — Delete Snapshot UTI-COMPTA-SAGE
2018-02-11-03-27-14 — Backup done
I have a VM that works well that is 3 GB but other VM can not export
Hi Sully this is an error with the temp directory that gets full. I working on a new version which will fix this!
Hi Sully, you can download Version 2 of the tool today. Version 2 has fixed the temp issue which you experienced.
Hoi Chris,
Me again (sorry!)
I’m trying to download the XenServer Powershell module but I keep getting a lovely message from Citrix (This content is restricted.)
I’ve used the tool and it works (when I back-up a small VM/drive) but not for my normal VM’s because of the temp folder issue.
I’ve used your tool so perhaps the Powershell module is allready installed? Or do I need to download the proper one from Citrix?
Sorry for asking a simple question like this, its just I’m heading to a customer of mine tomorrow and would like to know if using your tool once is enough to install the module. That way I don’t need to wait for Citrix response so I can download the module.
I’ve also learned your Dutch! That’s awesome so am I 🙂
Thanks in advanced and can’t wait till version 2!
James
Hi (Hallo) James,
My tool automatically install the XenServer PowerShell SDK. So you can also now script to XenServer 🙂
Awesome! thx this made my day 🙂
It took you well over 2min to reply…could do better hahaha 😛
I must be doing something wrong, I can’t figure out how to run without the tool.
Sorry I don’t use PowerShell a lot but importing a module I’ve done before. Can anyone point me in the correct direction?
PS C:\Users\username> Import-Module XenServerPSModule
PS C:\Users\username> Invoke-Xenbackup
Invoke-Xenbackup : The term ‘Invoke-Xenbackup’ is not recognized as the name of a cmdlet, function, script file, or ope
rable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again
.
At line:1 char:1
+ Invoke-Xenbackup
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Invoke-Xenbackup:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Hi James,
That’s no problem, what you must do is first load in the function. The easiest way is to open Visual Studio Code or PowerShell ISE type in the first line import-module XenServerPSModule then paste the script above under it. And then beneath that start the invoke-xenbackup !
Your super fast with replying wauw! Would you mind if I send you an email so I can ask a few things in Dutch?
I’m working on a live Xen Server and I’m a bit afraid I’ll mess it up with a script.
I understand if you don’t have the time for this, no harm done 🙂
You can always email me, no problem.
Awesome! I’ll send an email later today (stuck in traffic a little at the mom!)
Hello Chris,
Trying to use the tool on Win7 VM connecting to Xenserver 6.2. Had to install Powershell v3 & v4. When I connect I get error that username or password (verified over and over again) issue. In the logs it just says “The property ‘Pool’ cannot be found on this object. Verify that the property exists and can be set.”
+ CategoryInfo : Invalidoperation , Runtimexception
+ FullyQualifiedErrorId: PropertyNotFound
appreciate any help you can give?
thanks
Dan
Hi Dan,
It sound like the Installation of the SDK failed. Could confirm that it is installed properly? I also haven’t tested the tool on Win 7. Could you try Win10 or 2016/2012?
Dear Chris,
Hope you are well.First of all I would like to thank you for this wonderful work. It is amazing. I am using your script to make back-ups for machines in xenserver. But I have two problems:
1) When I open GUI, connect to xenserver and select machine then I click “Run Backups Now” as mentioned in your tutorial. After clicking, GUI becomes hangs and goes to non responding state.
2) When I reopen it and did same procedure, after that” backup done” appears on GUI but folder remains empty. Nothing is created in that folder. There is no xva file.
I will be much obliged for your help. Looking forward to hearing from you.
The GUI is not hanging it’s just waiting for the job to finish. The second time you opened it, it was probably still running the export. New tool coming soon and will have the “hanging” fixed.
Hi Syed, Version 2 of the tool is out and this fixes your issues. You can download the tool again and it should work.
Hello Chris,
thank you for that tool!
Unfortunately it does not work for me anymore .
I probably have the same problem as “Syed Muhammad Hassan”. I selected a folder on D:\ and started the backup manually. I can see how the snapshot is taken on the XS and space on C: (which I have not selected) gets filled up. After some time the GUI responds but there is no Backup under D:\.
Any ideas what I should do?
Regards
Kevin
Hi Kevin,
I will release version 2 of the tool with the fixes this month. In the mean time the script above in the blog is already version 2 and can be used. But does require some PowerShell knowledge.
Hi Kevin, Version 2 of the tool is out. This will fix your issues !
My job has been running for several hours for one machine with a 60GB disk. I noticed it was still running in task scheduler after 3+ hours. The logs says the following. I’m not sure what it’s pointing me to. It doesn’t look like this is part of the script generated.
Get-ScheduledTask : Cannot validate argument on parameter ‘TaskName’. The
argument is null. Provide a valid value for the argument, and then try running
the command again.
At line:864 char:45
+ $taskstate = Get-ScheduledTask -TaskName $task
+ ~~~~~
+ CategoryInfo : InvalidData: (:) [Get-ScheduledTask], ParameterB
indingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Get-ScheduledTa
sk
Please wait for version to be released later this month this will fix the issues or try using the PowerShell script in the blog.
Hi Zack, Version 2 of the tool is out. This will fix your issues !
Hi Chris,
Whenever the backup runs, the export snapshot job always fail exporting to the drive I use.
Ok can you see in the program data folder log why?
please disregard, it does worked. it just so happen the test VM i am backing up was too large, that the back up and compress job takes to long. anyway thanks Chris, I am glad I found your site.
Hi Sir,
Does this works with XCP-ng(opensource fork of XenServer)
Thanks!
To be honest I don’t know. If the XenServer Powershell sdk has support for xcp, then the tool should have to. You could try.
Thanks man, it worked!
Hi Chris,
Looked at your tool.. Not much of a PowerShell guy myself… still getting the following error…
Exception calling “ExtractToDirectory” with “2” argument(s): “Could not find a
part of the path ‘C:\Program Files\Workspace Guru\XenServer
Backup\XenServerPSModule.zip’.”
At line:684 char:5
+ … [System.IO.Compression.ZipFile]::ExtractToDirectory($zipf …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DirectoryNotFoundException
Import-Module : The specified module ‘XenServerPSModule’ was not loaded
because no valid module file was found in any module directory.
At line:1581 char:4
+ Import-Module XenServerPSModule
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (XenServerPSModule:String)
[Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Comm
ands.ImportModuleCommand
Unable to find type [XenAPI.Failure].
At line:1588 char:10
+ Catch [XenAPI.Failure] {
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (XenAPI.Failure:TypeName) [],
RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
So do i have to load any PowerShell SDK or something… Running the tool from Windows 2016 server..
Ah the folder has changed with thats why you get an error. I will fix it right away!
Hi Igor,
Could you redownload and install the tool. The SDK installation should be fixed !
Thank you!
Gr. Chris
Hi Chris,
I have version 2.0 and at some vm’s I get these error:
2019-20-02-05-13-34 — Start Backup for SRV001 to C:\Temp
2019-20-02-05-13-35 — Create Snapshot SRV001
2019-20-02-05-13-39 — Export Snapshot SRV001
2019-20-02-05-13-39 — ERROR —- Export Snapshot SRV001 failed
2019-20-02-05-13-39 — Delete Snapshot SRV001
2019-20-02-05-13-40 — Start ZIP of Backup
2019-20-02-05-13-41 — Delete non ZIPd backup
2019-20-02-05-13-41 — Backup done
Ok is there enough space in c temp? And are there existing snapshots ?
Can this script clean up old backups, or can you specify how many backups of each machine should be kept at a time?
No not yet but it’s a good feature request !
Yes please!
Hi!
I have an issue when the snapshots gets exported.
The vm folders are created, but the files never gets there.
here is the error section:
\\freenas\XEN-bkp\xen01 is Network drive, will mount drive
2019-28-02-03-10-41 — Start Backup
2019-28-02-03-10-41 — Create Snapshot abcd.local
2019-28-02-03-10-43 — Create Snapshot win2012
2019-28-02-03-10-45 — Create Snapshot centos2
2019-28-02-03-10-47 — Create Snapshot ubuntu
2019-28-02-03-10-49 — Create Snapshot DC01.win2012.local
2019-28-02-03-10-55 — Export Snapshot abcd.local
Export-XenVm : Cannot convert ‘System.Object[]’ to the type ‘System.String’ required by parameter ‘Uuid’. Specified method is not supported.
At C:\ProgramData\Workspace-Guru\XenServer-Backup\Scripts\XenServer_Backup_12_00-xen01-bkp.ps1:201 char:29
+ … Export-XenVm -Uuid $SnapshotUuid.uuid -XenHos …
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Export-XenVm], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Citrix.XenServer.Commands.ExportXenVmCommand
2019-28-02-03-10-55 — ERROR —- Export Snapshot abcd.local failed
2019-28-02-03-10-55 — Delete Snapshot abcd.local
–> Cannot convert ‘System.Object[]’ to the type ‘System.Guid’ required by parameter ‘Uuid’. Specified method is not supported.
——–
line 201:
Export-XenVm -Uuid $SnapshotUuid.uuid -XenHost “$XenHost” -path “$ExportPath\XenBackup-$backupdate\$VMName\$VMName-backup.xva”
Looks like there is an issue with the XenServer Powershell SDK module. Can you check if it is installed correctly?
Hi! thanks for the help, I checked, the problem was because of the initialy started snapshouts, it had to be deleted so the task could start fresh
Hi.
How you resolve the problem?
I have this problem and I can’t resolve it.
I have a snapshot made before the use of this tools. ¿must be deleted to permit this tool execute correctly?
Thanks!
Confirmed!!!!
Must be deleted the previous snapshots…….
Sorry for the noobish question but in case of a server fail how do I restore all back up? Do I need to reinstall Xen Server and then recreate the VM’s from the snapshots ?
Thank’s for all your work BTW 🙂
Hi Enzo, you must reinstall XenServer and then you can import the backup in xencenter.
Thanks a lot
I install on my Win10 PC, which is an italian OS version and once I click “Get VM’s” I get the error: Could not update VM list please check credentials and hostname, or check ….XenServer-Backup…..txt
This log file has the floowing message:
Eccezione durante la chiamata di “ExtractToDirectory” con “2” argomento/i:
“Impossibile trovare una parte del percorso ‘C:\Program Files\Workspace
Guru\XenServer Backup V2\XenServerPSModule.zip’.”
In riga:684 car:5
+ … [System.IO.Compression.ZipFile]::ExtractToDirectory($zipf …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DirectoryNotFoundException
Import-Module : Impossibile caricare il modulo ‘XenServerPSModule’
specificato. Nessun file di modulo valido trovato nelle directory dei moduli.
In riga:1581 car:4
+ Import-Module XenServerPSModule
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (XenServerPSModule:String)
[Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Comm
ands.ImportModuleCommand
Impossibile trovare il tipo [XenAPI.Failure].
In riga:1588 car:10
+ Catch [XenAPI.Failure] {
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (XenAPI.Failure:TypeName) [],
RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
If I check on my PC that path it does not exist!
Is your installer thaking care of system Language? How to solve the problem?
Thanx.
Pas.
Hi Pas,
There was an error with the PS module install. Thank you for catching it.
I updated the tool and it should now work.
Please uninstall, redownload and then install again.
Thanks for your comment.
Hi Chris,
Thank you. Downloaded and installed. Once set and click “Get VMs”, I get the following error:
Connect-XenServer : Response from server does not contain valid XML.
In riga:1585 car:16
+ … $Session = Connect-XenServer -Url https://$Xenhost -UserName “$usern …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-XenServer], XmlRpcIll
FormedXmlException
+ FullyQualifiedErrorId : CookComputing.XmlRpc.XmlRpcIllFormedXmlException
,Citrix.XenServer.Commands.ConnectXenServerCommand
FYI: I’m running XenServer 7.6. Is anything specific at my side to set?
Ok should work. Can you try doing Powershell commands directly ? I will perform a test with 7,6 next week.
Hi Chris,
It was my fault. I corrected it. Now I get the VM list (just one VM) I select it and configure:
-backup path
-usrname for task
-pwd for task
-bckup time
-bckup name
Click create scheduled task and get the following error:
Chiamata al metodo non riuscita. [System.Object[]] non contiene un metodo
denominato ‘trim’.
In riga:2206 car:4
+ $VMs = $VMs.trim() -join “”, ‘”,”‘ -replace ‘ “‘, ‘”‘
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Register-ScheduledTask : Non è stato effettuato alcun mapping tra nomi di
account e ID di sicurezza (SID).
(18,8):UserId:
In riga:2779 car:12
+ … Register-ScheduledTask -TaskName “XenServer_Backup_$BBTim …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (PS_ScheduledTask:Root/Microsoft/.
..S_ScheduledTask) [Register-ScheduledTask], CimException
+ FullyQualifiedErrorId : HRESULT 0x80070534,Register-ScheduledTask
What should I do?
Pas
You ran the app from windows 10 right ? Try running it from windows 2016. I did not do existence test on win 10
Hi Chris,
first of all thanks for setting up this project.
I tested the tool (gui+script), but I experienced that not the whole VM is snapshotted or the snapshot is incomplete. A re-import to Xencenter fails with “premature end of file”.
I have Xenserver 7.6 and on Backup side it’s Win10.
The Log file says nothing really exciting:
2019-23-05-12-31-58 — Start Backup for VM_Wbmail to C:\temp
2019-23-05-12-31-59 — Create Snapshot VM_Wbmail
2019-23-05-12-32-03 — Export Snapshot VM_Wbmail
2019-23-05-12-32-03 — Export path: C:\temp\XenBackup-2019-05-23\VM_Wbmail\VM_Wbmail-backup.xva
2019-23-05-12-46-58 — Export Snapshot VM_Wbmail finished
2019-23-05-12-46-58 — Delete Snapshot VM_Wbmail
2019-23-05-12-46-59 — Start ZIP of Backup
2019-23-05-12-55-24 — Delete non ZIPd backup
2019-23-05-12-55-24 — Backup done
Any ideas?
Thanks,
Lars
Does the VM have exciting snapshots? That can give some problems.
Is there a possibility to select the disk I want to backup? because I have vms with a lot of data but on disks separate from the operating system, if I select every VM this will generate large files and longer backup time.
it is also of great help the software thanks!
That’s a great feature request will look into it.
Hi,
we are trying to install your tool on windows 10, but it’s giving the Power Shell error that Power Shell V3 should be installed however, Windows 10 has Powershell v5 which is compatible with version 1.2.3.4 as well.
Hello,
Is there any solution for the use of this solution with windows 10.
thank you
Mehrez
Not yet but I will look into it as soon as I got some free time 😉
Hi,
Getting this error while scheduling or running the backup now any idea how to deal with it?
I n v o k e – X e n V M : C a n n o t c o n v e r t ‘ S y s t e m . O b j e c t [ ] ‘ t o t h e t y p e ‘ S y s t e m . G u i d ‘ r e q u i r e d b y p a r a m e t e r
‘ U u i d ‘ . S p e c i f i e d m e t h o d i s n o t s u p p o r t e d .
A t C : \ P r o g r a m D a t a \ W o r k s p a c e – G u r u \ X e n S e r v e r – B a c k u p \ S c r i p t s \ X e n S e r v e r _ B a c k u p _ 1 9 _ 0 0 – 1 5 A p p s 2 . p s 1 : 1 8 3
c h a r : 3 0
+ . . . I n v o k e – X e n V M – U u i d $ V M U U i d . u u i d – X e n A c t . . .
+ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
+ C a t e g o r y I n f o : I n v a l i d A r g u m e n t : ( : ) [ I n v o k e – X e n V M ] , P a r a m e t e r B i n d i n g E x c e p t i o n
+ F u l l y Q u a l i f i e d E r r o r I d : C a n n o t C o n v e r t A r g u m e n t , C i t r i x . X e n S e r v e r . C o m m a n d s . I n v o k e X e n V M
Can you check if the Powershell module is correctly installed? Try running the script in the blog instead of the tool to troubleshoot. Or try running the tool on win2016/2019
Hi Chris,
When am trying to export to network drive its failing, there is enough space in network drive also am taking back of other applications to this network drive those are fine, but its failing from the tool. Below are from logs please help.
2020-24-02-08-26-26 — Start Backup for Motshelo_Choppies to \\X.X.X.X\NetBackup\backup
2020-24-02-08-26-26 — Create Snapshot Motshelo_Choppies
2020-24-02-08-26-31 — Export Snapshot Motshelo_Choppies
2020-24-02-08-26-31 — ERROR —- Export Snapshot Motshelo_Choppies failed
2020-24-02-08-26-31 — Delete Snapshot Motshelo_Choppies
Can you check out the detailed log in program data ? I think your VM might already have a snapshot.
Hi Chris,
Below are detailed logs.
TaskPath TaskName
——– ——–
\ XenServer_Backup_02_00-Motshe…
0
When am doing for local drive its fine.
Try running the PowerShell script version above to get an advanced log.
Hi Chris,
When I run power shell script manually its exporting, since the VM size is around 1TB still is in process. When we run in scheduler to export to network path we need to use (net use command) along with network path and its credentials. Please help in adding those in the power-shell script provided.
Hi Shakeel,
The script mounts the drives with New-PSDrive instead of Net use, maybe you system doesn’t support New-PSDrive ?
Hi Chris,
Installed VM’s Backup Tool configured, it created a PS script C:\ProgramData\Workspace-Guru\XenServer-Backup\Scripts\XenServer_Backup_02_00-CHO_MOT_BKP.ps1 also added in task scheduler.
– Its not running in task scheduler.
– Same script that is created by installer is running if I run directly in Power shell command window
below are the details and PS version.
PS C:\Users\Administrator> cd C:\ProgramData\Workspace-Guru\XenServer-Backup\Scripts
PS C:\ProgramData\Workspace-Guru\XenServer-Backup\Scripts> .\XenServer_Backup_02_00-CHO_MOT_BKP.ps1
2020-24-02-12-45-41 — Start Backup
2020-24-02-12-45-42 — Create Snapshot Motshelo_Choppies
2020-24-02-12-45-47 — Export Snapshot Motshelo_Choppies
2020-24-02-04-40-13 — Export Snapshot Motshelo_Choppies finished
2020-24-02-04-40-13 — Delete Snapshot Motshelo_Choppies
–> This operation cannot be performed because a VDI is in use by some other operation.
2020-24-02-04-40-14 — Start ZIP of Backup
2020-24-02-07-40-03 — Delete non ZIPd backup
2020-24-02-07-40-08 — Backup done
PS C:\ProgramData\Workspace-Guru\XenServer-Backup\Scripts> get-host
Name : ConsoleHost
Version : 4.0
InstanceId : aaf2c2c2-acc1-4c3d-b2b7-c74a935e69ce
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Thanks,
Shakeel
Muito bom o post, belo trabalho mesmo foi de encontro com uma coisa que eu estava precisando. Parabéns.
Hi Chris,
I used your tool last week to export my VMs so I could recreate my vms after the reinstall of my server.
I noticed when I imported the vm it was not available, but a template of the imported vm existed. Later I also saw the comment of Tonny Andersson from 14 April 2018 at 20:53:
“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”
When I looked at the script the tool created, this line is present but commented out (#). Is there a specific reason for this?
Would love to see this working straight from the tool.
PS
For the exiting VMs I imported I was able to fix this with the next command on my xcp-ng host, where is the UUID after the import:
xe vm-param-set is-a-template=false uuid=
This put it back to be a normal VM again.
Thats a good point I will look into it !
the comment is leaving out what is between brackets, the PS above should read
“PS
For the exiting VMs I imported I was able to fix this with the next command on my xcp-ng host, where VMUUID is the UUID after the import:
xe vm-param-set is-a-template=false uuid=VMUUID
This put it back to be a normal VM again.”
Chris, first of all, thanks for your effort to bring us with this tool, this is great.
If I can ask, can you add authentication mode to send e-mails ? Almost every servers does not permit send e-mails without authentication.
I have made the properly modifications in the script to do these authentication and it works, but I have to do this manually every new script.
I think this feature would be usefull for every user of your tool.
Thanks
check ! I’m busy with Version 3 and I will take a look at this. It sounds handy !
Hi Chris, is there anything you can say about the progress on version 3?
Will be happy to test if this can help you
Hi Hijmen,
Im sorry to say the progress is very slow.
I have moved houses earlier this year and at moment I have it really busy with the day job.
But it is still on my to do list.
Hi Marcelo,
My modifications are was not working on script, please can you correct me.
Send-MailMessage $myself@gmail.com -to $myself@gmail.com -subject $messageSubject -body $body -BodyAsHtml -smtpServer $SMTPServer -credentail $mycredentials -Attachments “$Logfile”
Hi I am trying to use this script with a resource pool and get the error message below. The Xen version is 8.2 with the script running on Win2012 server R2. Do you know if I can add the IP of the resource pool master to resolve? I would be happy to send you a donation if you can help me get it working. Thanks in advance!
The property ‘Pool’ cannot be found on this object. Verify that the property
exists and can be set.
At line:1591 char:5
+ $Pools.Pool = $PoolMaster
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
Hi Chris,
I was testing your tool last week to export and create snapshots for my VMs. For redhat no issue while exporting 2019 VM’s. i seeing this error message. Not sure why.
Backup Log fie:
2021-28-04-09-45-37 — Export Snapshot 2019testvm
2021-28-04-09-45-38 — ERROR —- Export Snapshot 2019testvm failed
Powershell Error Message:
Export-XenVm : Cannot convert ‘System.Object[]’ to the type ‘System.String’ required by parameter ‘Uuid’. Specified method is not supported.
At C:\ProgramData\Workspace-Guru\XenServer-Backup\Scripts\XenServer_Backup_22_00-2019VMBackupTest.ps1:201 char:29
+ … Export-XenVm -Uuid $SnapshotUuid.uuid -XenHos …
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Export-XenVm], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Citrix.XenServer.Commands.ExportXenVmCommand
Looks like there are multiple snapshots. This is not supported with the backup tool.
Thank you for the tool. Truly appreciate it. Unfortunately, I am not showing any files being written in to the folder nor the logfile has any details other than 2021-30-11-10-45-56 — Start Backup for mysrvr – W2k12R2 -7-23-21 to D:
The task still show running.
Hi There,
one question about the implementation Email-authentication feature, ist this still a goal?
is there a workaround?
Thx
Hi.
Here on Win2008R2 SP1 x64 the GUI works, but when i try to execute the Task, there’s only some errors in the log. The script is generated, so I tried it directly in a powershell window. Can’t be executed because powershell doesn’t execute local scripts in the given location by default. I put a “.\” before calling the script and it worked. Execution policy is set to unrestricted. Perhaps you can integrate the “.\” in your script-generator.
Hello, please do you use multi-threaded or single-threaded for the current 2.0 version of the tool??
If it is single-threaded, how can I import multi-threaded scripts??
The tool is single threaded, multi thread option is avaible in the form of a PowerShell script.
Hello, does multithreading mean that you can execute multiple tasks at the same time??
Hi Chris
I’m a experiencing a small issue with your tool. I click ‘Get VM’s’, they list ok. I select the VM and backup path. I click ‘Run Backup NOW’ but get asked to enter a password in the ‘Password of user to run task’ field, followed by the ‘user’ and ‘backup names’. In your video demonstration, it’s my understanding these fields are only necessary if creating a scheduled task. Grateful for your advice why it would be doing this.
Hi Chris,
i am running Citrix Hypervisor 8.2 CU1 and get your tool only working with the included Powershell Modules. Every newer Version of the SDK/PS Modules will show an error if getting the VM’s with the Gui.
I only have the log in german:
Import-Module : Die Datei oder Assembly “file:///C:\Windows\system32\WindowsPow
erShell\v1.0\Modules\XenServerPSModule\CookComputing.XmlRpcV2.dll” oder eine
Abhängigkeit davon wurde nicht gefunden. Der Vorgang wird nicht unterstützt.
(Ausnahme von HRESULT: 0x80131515)
In Zeile:1581 Zeichen:4
+ Import-Module XenServerPSModule
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], FileLoadE
xception
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Co
mmands.ImportModuleCommand
Der Typ [XenAPI.Failure] wurde nicht gefunden.
In Zeile:1588 Zeichen:10
+ Catch [XenAPI.Failure] {
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (XenAPI.Failure:TypeName) [],
RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
Hi Chris,
the tool is really very useful, but is it possible to run the task with a managed service account?
If I try it I always get an error.
Hi Chris, it doesn’t work with Xen 8.2, it always gets an error “The VM could not be imported: the end of the file was reached prematurely.”
Are you thinking about an upgrade?
Thank you