Hyper-V-Backup

4.5

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

Show more

Installation Options

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

Install-Script -Name Hyper-V-Backup -RequiredVersion 4.5

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy 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

Owners

Copyright

(C) Mike Galvin. All rights reserved.

Package Details

Author(s)

  • Mike Galvin Contact: mike@gal.vin twitter.com/mikegalvin_

Tags

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

Dependencies

This script has no dependencies.

FileList

Version History

Version Downloads Last updated
24.3.18 1 3/18/2024
24.3.8 27 3/11/2024
23.9.5 362 9/16/2023
23.4.28 274 4/28/2023
23.2.18 160 2/18/2023
23.2.7 21 2/9/2023
23.1.9 84 1/9/2023
22.6.22 374 6/22/2022
22.6.18 23 6/18/2022
22.6.17 16 6/17/2022
22.6.11 17 6/14/2022
22.3.26 142 3/27/2022
22.2.8 106 2/9/2022
22.1.19 63 1/20/2022
21.12.28 53 12/28/2021
21.11.9 89 11/12/2021
21.11.5 27 11/5/2021
21.8.10 148 8/10/2021
21.7.2 70 7/2/2021
21.6.14 49 6/14/2021
21.6.2 31 6/2/2021
21.5.30 17 5/30/2021
20.7.13 431 7/26/2020
20.3.20 237 3/20/2020
20.2.28 41 2/28/2020
20.2.14 45 2/17/2020
4.5 (current version) 153 9/4/2019
4.4 94 5/26/2019
4.3 288 6/21/2018
4.2 95 3/4/2018
4.1 22 3/3/2018
4.0 31 1/15/2018
3.9 12 1/12/2018
3.8 12 1/12/2018
3.7 57 10/16/2017
3.6 37 10/6/2017
3.5.1 15 10/5/2017
Show less