Backup Virtual-Hard-Disk: Difference between revisions
No edit summary |
|||
Line 123: | Line 123: | ||
</Setup> | </Setup> | ||
< | <Filters> | ||
<Filter> | |||
<String>vm-anyname</String> | |||
<Type>include</Type> | |||
</Filter> | |||
<Filter> | |||
<String> | <String>another disk name</String> | ||
<Type>include</Type> | |||
</Filter> | |||
<Filter> | |||
<String>one more disk name</String> | |||
<Type>include</Type> | |||
</Filter> | |||
<Filter> | |||
<String>exclude this disk</String> | |||
<Type>exclude</Type> | |||
</Filter> | |||
<Filter> | <Filter> | ||
<String>exclude another disk name</String> | |||
<Type>exclude</Type> | |||
</Filter> | |||
</Filters> | |||
</CONFIG> | </CONFIG> |
Revision as of 18:21, 9 August 2019
Easy and cheap way to backup your running Hyper-V disks. The script is using the VSS technology to allow you to backup your disk even if the VM is in use.
The script is using an individual xml configuration to allow a flexible way of doing backups
The Chilcat ActiveX component is needed for reading the configuration, please get it here
- The script has been tested on Windows 10 and Server 2016.
Syntax:
> cscript hvbackup.vbs
Note that the default configuration (hvbackup.xml) is getting loaded if no parameter is given
Alternative Syntax
> cscript hvbackup.vbs <optional configuration.xml>
Setup hvbackup.xml
- Edit hvbackup.xml
XML Child Element | XML Attribute | Value |
---|---|---|
SETUP |
VSSPath |
The VSSPath is a symbolic link to be used and created by the script to copy the data through VSS |
VSSCheck |
Optional value (0 or 1) to specify if the VSS should be created on startup, it is recommended to do so. | |
VSSAutomaticCreate |
Set to create the create the VSSS, (0 or 1). It is recommended to do so. | |
WriteLogfile |
Switch on log file writing which is recommended. (0 or 1) | |
LogPath |
Specify the directory where the logs should get written to | |
SourcePath |
Specify the root directory of your VM, please note that the script recursive walks down all paths and tries to find VHDX files. | |
TargetPath |
Specify the target directory where you want to backup your disks. | |
MinFreeDiskSpaceGB |
Check the amount of free disk space on the target befoe we refuse the backup operation. | |
DataRetention |
Amount of disks which we keep on the target | |
RemoveVSSOnExit |
Specify (0 or 1) to remove the VSS once the backup operation has been completed, recommend to do so. | |
Filter (Array) |
String |
Any alphanumeric string to search for disk names |
Type |
The type of filter, this can be include or exclude |
Example
<?xml version="1.0"?> <CONFIG> <Setup> <VSSPath>e:\$vss$</VSSPath> <VSSCheck>1</VSSCheck> <VSSAutomaticCreate>1</VSSAutomaticCreate> <WriteLogfile>1</WriteLogfile> <LogPath>u:\vbskript\vss-vhd\log</LogPath> <SourcePath>e:\virtual-machines</SourcePath> <TargetPath>\\mis07\e$\Backup\</TargetPath> <MinFreeDiskSpaceGB>50</MinFreeDiskSpaceGB> <DataRetention>3</DataRetention> <RemoveVSSOnExit>1</RemoveVSSOnExit> </Setup> <Filters> <Filter> <String>vm-anyname</String> <Type>include</Type> </Filter> <Filter> <String>another disk name</String> <Type>include</Type> </Filter>
<Filter> <String>one more disk name</String> <Type>include</Type> </Filter> <Filter> <String>exclude this disk</String> <Type>exclude</Type> </Filter> <Filter> <String>exclude another disk name</String> <Type>exclude</Type> </Filter> </Filters> </CONFIG>