vagrant/plugins/providers/hyperv/scripts/list_snapshots.ps1

13 lines
294 B
PowerShell
Raw Normal View History

2016-03-05 16:41:18 +00:00
Param(
[Parameter(Mandatory=$true)]
[string]$VmId
)
$VM = Hyper-V\Get-VM -Id $VmId -ErrorAction "Stop"
$Snapshots = @(Hyper-V\Get-VMSnapshot $VM | Select-Object Name)
2016-03-05 16:41:18 +00:00
$result = ConvertTo-json $Snapshots
Write-Host "===Begin-Output==="
Write-Host $result
Write-Host "===End-Output==="