From 9c149ba8b169d6b39bb531c6cbc62a437905f27a Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Tue, 31 Jul 2018 13:33:41 -0700 Subject: [PATCH] Only enable ExposeVirtualizationExtensions if available within Hyper-V version --- .../hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 b/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 index d04698b85..d277f4e9c 100644 --- a/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 +++ b/plugins/providers/hyperv/scripts/utils/VagrantVM/VagrantVM.psm1 @@ -535,6 +535,15 @@ function Set-VagrantVMVirtExtensions { [bool] $Enabled=$false ) + # Check that this option is available + if((Get-Command Hyper-V\Set-VMProcessor).Parameters["ExposeVirtualizationExtensions"] -eq $null) { + if($Enabled) { + throw "ExposeVirtualizationExtensions is not available" + } else { + return $VM + } + } + Hyper-V\Set-VMProcessor -VM $VM -ExposeVirtualizationExtensions $Enabled return $VM <#