Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Conversation

@kmazurek
Copy link
Contributor

@kmazurek kmazurek commented Mar 26, 2019

Resolves: #4024

Updated the relevant Powershell script to use the field
HypervisorPresent from Win32_ComputerSystem WMI object. This provides a
more reliable way of determining hypervisor availability on the system.

Updated the relevant Powershell script to use the field
HypervisorPresent from Win32_ComputerSystem WMI object. This provides a
more reliable way of determining hypervisor availability on the system.
@ghost ghost assigned kmazurek Mar 26, 2019
@ghost ghost added the in progress label Mar 26, 2019
Copy link

@Wiezzel Wiezzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HypervisorPresent is true even if hypervisor service is not running.

@kmazurek
Copy link
Contributor Author

Ok, I'll keep the check for vmms process running. However, from my testing HypervisorPresent covers more cases than the call to Get-Module -ListAvailable hyper-v. I'm going to replace the latter with the former in the script.

@Wiezzel
Copy link

Wiezzel commented Mar 27, 2019

@zakaprov Maybe instead of this try-catch do this:

(Get-Service -Name vmms).Status -Eq "Running"

@Wiezzel
Copy link

Wiezzel commented Mar 27, 2019

And you could also check vmcompute service.

@kmazurek
Copy link
Contributor Author

@Wiezzel Good one, thanks. I might still need to wrap the call to Get-Service in a try-catch since these services may not be present on a fresh system. Will try to verify that.

Copy link

@Wiezzel Wiezzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $IsHypervisorPresent is False the script should return False.

@kmazurek
Copy link
Contributor Author

kmazurek commented Mar 27, 2019

@Wiezzel It does return False, the last line of the script got conveniently truncated in the GitHub changes viewer.

@codecov
Copy link

codecov bot commented Mar 28, 2019

Codecov Report

Merging #4044 into b0.19 will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##            b0.19    #4044   +/-   ##
=======================================
  Coverage   89.25%   89.25%           
=======================================
  Files         205      205           
  Lines       18431    18431           
=======================================
  Hits        16450    16450           
  Misses       1981     1981

@shadeofblue shadeofblue merged commit d6d8bd1 into b0.19 Mar 28, 2019
@ghost ghost removed the in progress label Mar 28, 2019
@shadeofblue shadeofblue deleted the improve-hyperv-detection branch March 28, 2019 11:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants