20 lines
393 B
PowerShell
20 lines
393 B
PowerShell
#Requires -Modules VagrantMessages
|
|
|
|
param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$VmId
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
try {
|
|
$VM = Hyper-V\Get-VM -Id $VmId
|
|
$Snapshots = @(Hyper-V\Get-VMSnapshot $VM | Select-Object Name)
|
|
} catch {
|
|
Write-Error-Message "Failed to get snapshot list: ${PSItem}"
|
|
exit 1
|
|
}
|
|
|
|
$result = ConvertTo-json $Snapshots
|
|
Write-Output-Message $result
|