From 6caa7bfa862946d791772cf96d108316038437dc Mon Sep 17 00:00:00 2001 From: Matt Shanahan Date: Fri, 19 Jul 2019 07:48:03 +0200 Subject: [PATCH] Fixes issue hashicorp#10973: checks that VMMS WMI reference is null & throws appropriately --- .../providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 b/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 index f130dc7de..65adb101d 100644 --- a/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 +++ b/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 @@ -355,6 +355,9 @@ function Report-ErrorVagrantVMImport { ) $ManagementService = Get-WmiObject -Namespace 'root\virtualization\v2' -Class 'Msvm_VirtualSystemManagementService' + if($null -eq $ManagementService) { + throw 'The Hyper-V Virtual Machine Management Service (VMMS) is not running.' + } # Relative path names will fail when attempting to import a system # definition so always ensure we are using the full path to the