Hyper-V-Backup

4.4

This script creates a full backup of running Hyper-V Virtual Machines.

This script will:

Create a full backup of Virtual Machine(s), complete with configuration, snapshots/checkpoints, and VHD files.

The -List switch should be used to specify a txt file with a list of VM names to backup. If this option is not
configured, all running VMs will be backed up.

If the -
This script creates a full backup of running Hyper-V Virtual Machines.

This script will:

Create a full backup of Virtual Machine(s), complete with configuration, snapshots/checkpoints, and VHD files.

The -List switch should be used to specify a txt file with a list of VM names to backup. If this option is not
configured, all running VMs will be backed up.

If the -NoPerms switch is used, the script will shutdown the VM and copy all the files to the backup location, then start the VM.
You should use the -NoPerms switch if Hyper-V does not have the appropriate permissions to the specified backup location to do an export.
If the -NoPerms switch is NOT used, the script will use the built-in export function, and the VMs will continue to run.

The -Keep switch should be used to keep the specified number of days worth of backups. For example, to keep one months worth of backups
use -Keep 30.

The -Compress switch should be used to generate a zip file of each VM that is backed up. The original backup folder will be deleted afterwards.

Important note: This script should be run on a Hyper-V host. The Hyper-V PowerShell management modules should be installed.

Please note: to send a log file using ssl and an SMTP password you must generate an encrypted
password file. The password file is unique to both the user and machine.

The command is as follows:

$creds = Get-Credential
$creds.Password | ConvertFrom-SecureString | Set-Content c:\foo\ps-script-pwd.txt

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Script -Name Hyper-V-Backup

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deloy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Author(s)

Mike Galvin twitter.com/mikegalvin_

Copyright

(C) Mike Galvin. All rights reserved.

Owners

Tags

Hyper-V Virtual Machines Cluster CSV Full Backup Export Permissions Zip History

Dependencies

This script has no dependencies.

Version History

Version Downloads Last updated
4.4 (current version) 18 5/26/2019