From 1554f447f291339724e5a92f4b67e4e83f86dbb6 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 13 Jun 2018 07:59:56 -0700 Subject: [PATCH] Disconnect all configured network adapters When importing a Hyper-V VM ensure all adapters are disconnected from switches that were used when the box was built. --- .../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 885d3c6b1..7da5c5bf5 100644 --- a/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 +++ b/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 @@ -96,6 +96,9 @@ function New-VagrantVMVMCX { Hyper-V\Set-VMFirmware -VM $VM -EnableSecureBoot (Hyper-V\Get-VMFirmware -VM $VM).SecureBoot } + # Disconnect adapters from switches + Hyper-V\Get-VMNetworkAdapter -VM $VM | Hyper-V\Disconnect-VMNetworkAdapter + # Verify new VM $Report = Hyper-V\Compare-VM -CompatibilityReport $VMConfig if($Report.Incompatibilities.Length -gt 0){