@@ -91,13 +91,19 @@ func status() registry.State {
9191 ctx , cancel := context .WithTimeout (context .Background (), 8 * time .Second )
9292 defer cancel ()
9393
94- cmd := exec .CommandContext (ctx , path , "-NoProfile" , "-NonInteractive" , "@(Get-Wmiobject Win32_ComputerSystem).HypervisorPresent" )
94+ cmd := exec .CommandContext (ctx , path , "-NoProfile" , "-NonInteractive" , "@(Get-CimInstance Win32_ComputerSystem).HypervisorPresent" )
9595 out , err := cmd .CombinedOutput ()
9696
9797 if err != nil {
98- errorMessage := fmt .Errorf ("%s failed:\n %s" , strings .Join (cmd .Args , " " ), out )
99- fixMessage := "Start PowerShell as an Administrator"
100- return registry.State {Installed : false , Running : true , Error : errorMessage , Fix : fixMessage , Doc : docURL }
98+ cimError := fmt .Errorf ("%s failed:\n %s " , strings .Join (cmd .Args , " " ), out )
99+ cmd := exec .CommandContext (ctx , path , "-NoProfile" , "-NonInteractive" , "@(Get-Wmiobject Win32_ComputerSystem).HypervisorPresent" )
100+ out , err := cmd .CombinedOutput ()
101+ if err != nil {
102+ wmiError := fmt .Errorf ("%s failed:\n %s " , strings .Join (cmd .Args , " " ), out )
103+ errorMessage := fmt .Errorf ("%s\n %s" , cimError , wmiError )
104+ fixMessage := "Start PowerShell as an Administrator"
105+ return registry.State {Installed : false , Running : true , Error : errorMessage , Fix : fixMessage , Doc : docURL }
106+ }
101107 }
102108
103109 // Get-Wmiobject does not return an error code for false
0 commit comments