system() improved virtual detection (windows)

This commit is contained in:
Sebastian Hildebrandt 2022-01-17 17:36:23 +01:00
parent 783bc3d43b
commit 2402a309a2
4 changed files with 20 additions and 25 deletions

View File

@ -80,6 +80,8 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 5.10.3 | 2022-01-17 | `system()` improved virtual detection (windows) |
| 5.10.2 | 2022-01-17 | `uuid()` fix results (windows) |
| 5.10.1 | 2022-01-17 | `cpu()` fix manufacturer |
| 5.10.0 | 2022-01-09 | basic `Android` support |
| 5.9.18 | 2022-01-08 | `wifiConections()` fix empty issue (mac OS) |

View File

@ -57,6 +57,11 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">5.10.3</th>
<td>2022-01-17</td>
<td><span class="code">system()</span> improved virtual detection (windows)</td>
</tr>
<tr>
<th scope="row">5.10.2</th>
<td>2022-01-17</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.10.2</span></div>
<div class="version">New Version: <span id="version">5.10.3</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">

View File

@ -353,33 +353,21 @@ function system(callback) {
result.serial = util.getValue(lines, 'identifyingnumber', ':');
result.uuid = util.getValue(lines, 'uuid', ':').toLowerCase();
// detect virtual (1)
if (result.model.toLowerCase() === 'virtualbox' || result.model.toLowerCase() === 'kvm' || result.model.toLowerCase() === 'virtual machine' || result.model.toLowerCase() === 'bochs' || result.model.toLowerCase().startsWith('vmware')) {
const model = result.model.toLowerCase();
if (model === 'virtualbox' || model === 'kvm' || model === 'virtual machine' || model === 'bochs' || model.startsWith('vmware') || model.startsWith('qemu')) {
result.virtual = true;
switch (result.model.toLowerCase()) {
case 'virtualbox':
result.virtualHost = 'VirtualBox';
break;
case 'vmware':
result.virtualHost = 'VMware';
break;
case 'kvm':
result.virtualHost = 'KVM';
break;
case 'bochs':
result.virtualHost = 'bochs';
break;
}
if (model.startsWith('virtualbox')) { result.virtualHost = 'VirtualBox'; }
if (model.startsWith('vmware')) { result.virtualHost = 'VMware'; }
if (model.startsWith('kvm')) { result.virtualHost = 'KVM'; }
if (model.startsWith('bochs')) { result.virtualHost = 'bochs'; }
if (model.startsWith('qemu')) { result.virtualHost = 'KVM'; }
}
if (result.manufacturer.toLowerCase().startsWith('vmware') || result.manufacturer.toLowerCase() === 'xen') {
const manufacturer = result.manufacturer.toLowerCase();
if (manufacturer.startsWith('vmware') || manufacturer.startsWith('qemu') || manufacturer === 'xen') {
result.virtual = true;
switch (result.manufacturer.toLowerCase()) {
case 'vmware':
result.virtualHost = 'VMware';
break;
case 'xen':
result.virtualHost = 'Xen';
break;
}
if (manufacturer.startsWith('vmware')) { result.virtualHost = 'VMware'; }
if (manufacturer.startsWith('xen')) { result.virtualHost = 'Xen'; }
if (manufacturer.startsWith('qemu')) { result.virtualHost = 'KVM'; }
}
util.powerShell('Get-WmiObject MS_Systeminformation -Namespace "root/wmi" | fl *').then((stdout, error) => {
if (!error) {