Weekly Tip 42

Snapshot all Hyper-V VMs on a Host

Execute this script. Change the “$hosts =” line to reflect the name of your host. You can also modify the date format if you like on the “$date =” line.

import-module hyper-v

$host = “<host name>”

$date =  get-date -format yyyy-mm-ddThh-mm-ss

$vms = (get-vm -computername $host).name

ForEach ($vm in $vms) {

checkpoint-vm $vm -computername $host -snapshotname “$vm $date”

write-host “checkpoint created on $vm”

}

Share:

Facebook
Twitter
LinkedIn

Contact Us

Name
=
On Key

More Posts