Update Windows Hyper-V check
Checks only if the Hyper-V hypervisor is enabled instead of all Hyper-V features. This will allow detection where Hyper-V is in use for things like ApplicationGuard. Uses both Get-WindowsOptionalFeature and Get-WindowsFeature to support check on server and non-server version.
This commit is contained in:
parent
b75732416c
commit
a997a27b57
|
@ -107,9 +107,12 @@ module Vagrant
|
|||
return @_windows_hyperv_enabled if defined?(@_windows_hyperv_enabled)
|
||||
|
||||
@_windows_hyperv_enabled = -> {
|
||||
ps_cmd = "$(Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online).State"
|
||||
["Get-WindowsOptionalFeature", "Get-WindowsFeature"].each do |cmd_name|
|
||||
ps_cmd = "$(#{cmd_name} -FeatureName Microsoft-Hyper-V-Hypervisor).State"
|
||||
output = Vagrant::Util::PowerShell.execute_cmd(ps_cmd)
|
||||
return output == 'Enabled'
|
||||
return true if output == "Enabled"
|
||||
end
|
||||
return false
|
||||
}.call
|
||||
|
||||
return @_windows_hyperv_enabled
|
||||
|
|
Loading…
Reference in New Issue