mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-06-08 16:26:25 -04:00
Fixes the issue of Vagrant is unable to execute Get-WindowsOptionalFeature Command changes 2
Fixes #11932
This commit is contained in:
parent
b0a4109845
commit
88c5e17c5c
1 changed files with 1 additions and 2 deletions
|
|
@ -141,10 +141,9 @@ module Vagrant
|
|||
@_windows_hyperv_enabled = -> {
|
||||
{:"Get-WindowsOptionalFeature" => ["-Online"], :"Get-WindowsFeature" => []}.each do |cmd_name, arguments|
|
||||
parameters = arguments.join " "
|
||||
ps_cmd = "$(#{cmd_name} -FeatureName Microsoft-Hyper-V-Hypervisor #{parameters}).State"
|
||||
if cmd_name == "Get-WindowsFeature"
|
||||
ps_cmd = "if (Get-Command #{cmd_name} -ErrorAction SilentlyContinue){ $(#{cmd_name} -FeatureName Microsoft-Hyper-V-Hypervisor #{parameters}).State } else { 'Disabled' }"
|
||||
else
|
||||
ps_cmd = "$(#{cmd_name} -FeatureName Microsoft-Hyper-V-Hypervisor #{parameters}).State"
|
||||
end
|
||||
begin
|
||||
output = Vagrant::Util::PowerShell.execute_cmd(ps_cmd)
|
||||
|
|
|
|||
Loading…
Reference in a new issue