The next batch file creates a backup ("vm-export") of Xenserver and XCP-ng Virtual Machines.
Features:
- On demand backups or scheduled backups
- Creates logfile on local computer
- Does not have credentials in the script
- Will show all VMs when the script is invoked without parameters
- Shows time/duration of the backup
- Makes a local copy first (speed!)
- Can copy to NAS other network location
Maybe first install the XCP-ng-Center-20.04.01.33.msi
    
 software.
Running the script without a parameter:
C:\scripts>backupXenVM.bat
*** Tue 02/21/2023 14:38:00.02 --- Start OVA backup -------------------------------------------------------------------
*** Tue 02/21/2023 14:38:00.02 VMs:
*** Tue 02/21/2023 14:38:00.04
     name-label ( RW): Control domain on host: xcp-ng-abcdefg
     name-label ( RW): x16. Airsonic
     name-label ( RW): x14. mailAdmin
     name-label ( RW): x10. ARCHDC001
     name-label ( RW): x15. Roundcube
*** Tue 02/21/2023 14:38:00.29
*** Tue 02/21/2023 14:38:00.29 Usage: backupXenVM.bat "{name-label}"
*** Tue 02/21/2023 14:38:00.29
A typical run of the script looks like:
C:\scripts>backupXenVM.bat "x15. Roundcube"
*** Tue 02/21/2023 14:40:11.15 --- Start OVA backup -------------------------------------------------------------------
The command completed successfully.
New connections will be remembered.
Status       Local     Remote                    Network
-------------------------------------------------------------------------------
OK           E:        \\192.168.1.3\Backups\xe
                                                Microsoft Windows Network
The command completed successfully.
*** Tue 02/21/2023 14:40:11.46 Tue 02/21/2023 14:40:11.44 - Backup VM: "x15. Roundcube"
*** Tue 02/21/2023 14:40:11.48
uuid ( RO)           : d2dccf2b-d9d9-e801-1e3f-59f426bc0bb1
     name-label ( RW): x15. Roundcube
    power-state ( RO): running
*** Tue 02/21/2023 14:40:11.66 Shutdown VM with name-label: "x15. Roundcube"...
*** Tue 02/21/2023 14:40:18.56 Backup of VM with name-label: "x15. Roundcube"...
*** Tue 02/21/2023 14:41:39.84 Restarting VM with name-label: "x15. Roundcube"...
*** Tue 02/21/2023 14:41:39.89 Copying file to NAS...
*** Tue 02/21/2023 14:42:50.75 Backup procedure of VM "x15. Roundcube" ready.
02/21/2023  02:41 PM     4,969,158,144 x15. Roundcube.ova
*** Tue 02/21/2023 14:42:51.35 Start  : Tue 02/21/2023 14:40:11.15
*** Tue 02/21/2023 14:42:51.35 VM up  : Tue 02/21/2023 14:41:39.89
*** Tue 02/21/2023 14:42:51.37 End    : Tue 02/21/2023 14:42:51.35
*** Tue 02/21/2023 14:42:51.37 Ready.
No comments:
Post a Comment