osInfo() faster hyper-v detection (win)

This commit is contained in:
Sebastian Hildebrandt 2021-08-26 14:40:11 +02:00
parent adbbad2780
commit 193658a2ad
2 changed files with 8 additions and 5 deletions

View File

@ -203,7 +203,7 @@
</div> </div>
<div class="row number-section"> <div class="row number-section">
<div class="col-xl-4 col-lg-4 col-md-4 col-12"> <div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">14,535</div> <div class="numbers">14,587</div>
<div class="title">Lines of code</div> <div class="title">Lines of code</div>
</div> </div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12"> <div class="col-xl-4 col-lg-4 col-md-4 col-12">

View File

@ -324,7 +324,8 @@ function osInfo(callback) {
const workload = []; const workload = [];
workload.push(util.wmic('os get /value')); workload.push(util.wmic('os get /value'));
// workload.push(execPromise('systeminfo', util.execOptsWin)); // workload.push(execPromise('systeminfo', util.execOptsWin));
workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"')); // workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession')); workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::TerminalServerSession'));
util.promiseAll( util.promiseAll(
workload workload
@ -336,9 +337,11 @@ function osInfo(callback) {
result.servicepack = util.getValue(lines, 'ServicePackMajorVersion', '=').trim() + '.' + util.getValue(lines, 'ServicePackMinorVersion', '=').trim(); result.servicepack = util.getValue(lines, 'ServicePackMajorVersion', '=').trim() + '.' + util.getValue(lines, 'ServicePackMinorVersion', '=').trim();
result.codepage = util.getCodepage(); result.codepage = util.getCodepage();
// const systeminfo = data.results[1] ? data.results[1].toString() : ''; // const systeminfo = data.results[1] ? data.results[1].toString() : '';
// result.hypervisor = (systeminfo.indexOf('hypervisor has been detected') !== -1) || (systeminfo.indexOf('Es wurde ein Hypervisor erkannt') !== -1) || (systeminfo.indexOf('Un hyperviseur a ') !== -1); // result.hypervisor = (systeminfo.indexOf('hypervisor has been detected') !== -1) || (systeminfo.indexOf('ein Hypervisor erkannt') !== -1) || (systeminfo.indexOf('Un hyperviseur a ') !== -1);
const hyperv = data.results[1] ? data.results[1].toString().split('\r\n') : []; // const hyperv = data.results[1] ? data.results[1].toString().split('\r\n') : [];
result.hypervisor = (util.getValue(hyperv, 'HyperVisorPresent').toLowerCase() === 'true'); // result.hypervisor = (util.getValue(hyperv, 'HyperVisorPresent').toLowerCase() === 'true');
const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : '';
result.hypervisor = hyperv.indexOf('true') !== -1;
const term = data.results[2] ? data.results[2].toString() : ''; const term = data.results[2] ? data.results[2].toString() : '';
result.remoteSession = (term.toString().toLowerCase().indexOf('true') >= 0); result.remoteSession = (term.toString().toLowerCase().indexOf('true') >= 0);
isUefiWindows().then(uefi => { isUefiWindows().then(uefi => {