diff --git a/pkg/minikube/registry/drvs/hyperv/hyperv.go b/pkg/minikube/registry/drvs/hyperv/hyperv.go index f711c6c92bb5..e80710df4c10 100644 --- a/pkg/minikube/registry/drvs/hyperv/hyperv.go +++ b/pkg/minikube/registry/drvs/hyperv/hyperv.go @@ -91,13 +91,19 @@ func status() registry.State { ctx, cancel := context.WithTimeout(context.Background(), 8*time.Second) defer cancel() - cmd := exec.CommandContext(ctx, path, "-NoProfile", "-NonInteractive", "@(Get-Wmiobject Win32_ComputerSystem).HypervisorPresent") + cmd := exec.CommandContext(ctx, path, "-NoProfile", "-NonInteractive", "@(Get-CimInstance Win32_ComputerSystem).HypervisorPresent") out, err := cmd.CombinedOutput() if err != nil { - errorMessage := fmt.Errorf("%s failed:\n%s", strings.Join(cmd.Args, " "), out) - fixMessage := "Start PowerShell as an Administrator" - return registry.State{Installed: false, Running: true, Error: errorMessage, Fix: fixMessage, Doc: docURL} + cimError := fmt.Errorf("%s failed:\n%s ", strings.Join(cmd.Args, " "), out) + cmd := exec.CommandContext(ctx, path, "-NoProfile", "-NonInteractive", "@(Get-Wmiobject Win32_ComputerSystem).HypervisorPresent") + out, err := cmd.CombinedOutput() + if err != nil { + wmiError:= fmt.Errorf("%s failed:\n%s ", strings.Join(cmd.Args, " "), out) + errorMessage := fmt.Errorf("%s\n%s", cimError, wmiError) + fixMessage := "Start PowerShell as an Administrator" + return registry.State{Installed: false, Running: true, Error: errorMessage, Fix: fixMessage, Doc: docURL} + } } // Get-Wmiobject does not return an error code for false