Powershell command to get a list of all the snapshot in vmm (hyper-v)

hyper-vpowershellscvmm

i am using below script to get snapshot which are associated with my particular VM, but i am getting only recent snapshot information , can someone correct me in below script –

$vmcheck = Get-VM -name VMNAME | where {$_.LastRestoredVMCheckpoint -like “* *”}

[string]$body = “`n”

$body += “NameCheckPointLocation`n”

foreach($vm in $vmcheck) {

$body += (“{0}{1}{2}`n” -f ($vm.name,$vm.LastRestoredVMCheckPoint,$vm.CheckPointLocation))

}

$body += “`n”

i need all the snapshots list which are associated with my vm

Best Answer

This is what you want (*):

$vm = Get-SCVirtualMachine -Name VMNAME
$vmCheckpoints = $vm.VMCheckpoints
foreach($checkpoint in $vmCheckpoints) {
  Write-Host $checkpoint
}

(*) I'm going on memory. I don't have immediate access to SCVMM at the moment.

Related Topic