Merge pull request #9746 from chrisroberts/e-hyper-v-check

Update Windows Hyper-V check
This commit is contained in:
Chris Roberts 2018-05-02 07:45:26 -07:00 committed by GitHub
commit 3f3777f03a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -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