Manage snapshots for MOC VMs in PowerShell 3.0

 

After installing the MOC VM’s on our pc’s it is recommended to have an initial restore point to which we can revert their state.

1. Create snapshots for ALL VMs

It can be done in GUI mode in Hyper-V selecting all VM’s, right click and select Snapshot.

All VM’s will have their initial snapshot with a name generated by the system (includes VM’s name and time stamp – date and hour.

Let’s do the same thing in in PowerShell 3.0

Get- VM | Checkpoint-VM

 

First part of the command will select al VM’s and the second part will make the snapshot for each VM.

Now all VM’s will have their initial snapshot with a name generated by the system (includes VM’s name and time stamp – date and hour.

2. Create snapshots for ALL VMs, each snapshot will be named: Initial point

If in GUI mode we want to make a snapshot for each VM and give same name to each VM’s snapshot then we need to do things on VM by VM basis.

In PowerShell 3.0 things are much easier.

Get- VM | Checkpoint-VM -SnapshotName “Initial point”

 

First part of the command will select all VM’s and the second part will make the snapshot for each VM with same name: Initial point.

3. Delete ALL snapshots for ALL VMs

If in GUI mode we want to delete all snapshots from each VM then we also need to do things on VM by VM basis.

In PowerShell 3.0 one line does it all.

Get- VM | Remove-VMSnapshot

First part of the command will select all VM’s and the second part will delete all the snapshots for each VM.

 

 

Live is too short, don’t waist it on classroom setups!

 

Florin Nicolescu

MCT

florin@learningsolution.ro

www.learningsolution.ro

www.cursurimicrosoft.com