Backup Virtual-Hard-Disk: Difference between revisions

From Coolscript
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by the same user not shown)
Line 158: Line 158:
|style="width:10%; vertical-align: top;"|
|style="width:10%; vertical-align: top;"|
'''Download the script'''<br>
'''Download the script'''<br>
[[File:Download.png|60px|link=http://coolscript.org/download/hvbackup.zip|Download]]
[[File:Download.png|60px|link=https://coolscript.org/download/scripts/hvbackup.zip|Download]]
<br>
<br>
|style="width:90%; vertical-align: top;"|
|style="width:90%; vertical-align: top;"|

Latest revision as of 14:10, 5 October 2023

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
psad2ipt.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>c:\$vss$</VSSPath>
     <VSSCheck>1</VSSCheck>
     <VSSAutomaticCreate>1</VSSAutomaticCreate>
     <WriteLogfile>1</WriteLogfile>
     <LogPath>c:\logs</LogPath>
     <SourcePath>c:\virtual-machines</SourcePath>
     <TargetPath>\\myTargetServer\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>


Download


Download the script
Download