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)
|
||||
|
||||
@_windows_hyperv_enabled = -> {
|
||||
ps_cmd = "$(Get-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-All -Online).State"
|
||||
output = Vagrant::Util::PowerShell.execute_cmd(ps_cmd)
|
||||
return output == 'Enabled'
|
||||
["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 true if output == "Enabled"
|
||||
end
|
||||
return false
|
||||
}.call
|
||||
|
||||
return @_windows_hyperv_enabled
|
||||
|
|
Loading…
Reference in New Issue