plugins/providers/hyperv/scripts/resume_vm.ps1 in vagrant-unbundled-2.1.1.0 vs plugins/providers/hyperv/scripts/resume_vm.ps1 in vagrant-unbundled-2.1.2.0
- old
+ new
@@ -1,7 +1,16 @@
-Param(
+#Requires -Modules VagrantMessages
+
+param(
[Parameter(Mandatory=$true)]
[string]$VmId
)
-$VM = Hyper-V\Get-VM -Id $VmId -ErrorAction "Stop"
-Hyper-V\Resume-VM $VM
+$ErrorActionPreference = "Stop"
+
+try {
+ $VM = Hyper-V\Get-VM -Id $VmId
+ Hyper-V\Resume-VM $VM
+} catch {
+ Write-ErrorMessage "Failed to resume VM: ${PSItem}"
+ exit 1
+}