Merge pull request #9746 from chrisroberts/e-hyper-v-check
Update Windows Hyper-V check
This commit is contained in:
commit
3f3777f03a
|
@ -107,9 +107,12 @@ module Vagrant
|
||||||
return @_windows_hyperv_enabled if defined?(@_windows_hyperv_enabled)
|
return @_windows_hyperv_enabled if defined?(@_windows_hyperv_enabled)
|
||||||
|
|
||||||
@_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|
|
||||||
output = Vagrant::Util::PowerShell.execute_cmd(ps_cmd)
|
ps_cmd = "$(#{cmd_name} -FeatureName Microsoft-Hyper-V-Hypervisor).State"
|
||||||
return output == 'Enabled'
|
output = Vagrant::Util::PowerShell.execute_cmd(ps_cmd)
|
||||||
|
return true if output == "Enabled"
|
||||||
|
end
|
||||||
|
return false
|
||||||
}.call
|
}.call
|
||||||
|
|
||||||
return @_windows_hyperv_enabled
|
return @_windows_hyperv_enabled
|
||||||
|
|
Loading…
Reference in New Issue