versions() fix postgres, code cleanup

This commit is contained in:
Sebastian Hildebrandt 2022-10-15 00:39:22 +02:00
parent 601bc680d0
commit 69b3571d98
8 changed files with 574 additions and 599 deletions

View File

@ -20,7 +20,7 @@
We had to make **several interface changes** to keep systeminformation as consistent as possible. We highly [recommend to go through the complete list](https://systeminformation.io/changes.html) and adapt your own code to be again compatible to the new version 5. We had to make **several interface changes** to keep systeminformation as consistent as possible. We highly [recommend to go through the complete list](https://systeminformation.io/changes.html) and adapt your own code to be again compatible to the new version 5.
| Function | Old | New (V5) | Comments | | Function | Old | New (V5) | Comments |
| --------------- | ------------------ | ------------------ | ------------------ | | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| unsupported values | -1 | null | values which are unknown or<br>unsupported on platform | | unsupported values | -1 | null | values which are unknown or<br>unsupported on platform |
| `battery()` | hasbattery<br>cyclecount<br>ischarging<br>designedcapacity<br>maxcapacity<br>acconnected<br>timeremaining | hasBattery<br>cycleCount<br>isCharging<br>designedCapacity<br>maxCapacity<br>acConnected<br>timeRemaining | pascalCase conformity | | `battery()` | hasbattery<br>cyclecount<br>ischarging<br>designedcapacity<br>maxcapacity<br>acconnected<br>timeremaining | hasBattery<br>cycleCount<br>isCharging<br>designedCapacity<br>maxCapacity<br>acConnected<br>timeRemaining | pascalCase conformity |
| `blockDevices()` | fstype | fsType | pascalCase conformity | | `blockDevices()` | fstype | fsType | pascalCase conformity |
@ -79,7 +79,8 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
## Version History ## Version History
| Version | Date | Comment | | Version | Date | Comment |
| -------------- | -------------- | -------- | | ------- | ---------- | --------------------------------------------------------------------------------------------------- |
| 5.12.7 | 2022-10-15 | `versions()` fix postgres |
| 5.12.6 | 2022-08-18 | `networkConnections()` fix UDP (windows) | | 5.12.6 | 2022-08-18 | `networkConnections()` fix UDP (windows) |
| 5.12.5 | 2022-08-11 | `cpu()` virtualization fix (mac OS) | | 5.12.5 | 2022-08-11 | `cpu()` virtualization fix (mac OS) |
| 5.12.4 | 2022-08-09 | `cpuTemperature()` fix main (linux) | | 5.12.4 | 2022-08-09 | `cpuTemperature()` fix main (linux) |
@ -304,7 +305,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| 4.23.1 | 2020-03-11 | `diskLayout()` optimized detection linux | | 4.23.1 | 2020-03-11 | `diskLayout()` optimized detection linux |
| 4.23.0 | 2020-03-08 | `versions()` added param to specify which program/lib versions to detect | | 4.23.0 | 2020-03-08 | `versions()` added param to specify which program/lib versions to detect |
| 4.22.7 | 2020-03-08 | `diskLayout()` fixed linux | | 4.22.7 | 2020-03-08 | `diskLayout()` fixed linux |
| 4.22.6 | 2020-03-08 | `network()` fixed DHCP linux| | 4.22.6 | 2020-03-08 | `network()` fixed DHCP linux |
| 4.22.5 | 2020-03-04 | `graphics()` fixed vram macOS | | 4.22.5 | 2020-03-04 | `graphics()` fixed vram macOS |
| 4.22.4 | 2020-03-01 | `versions()` added dotnet, typings fix | | 4.22.4 | 2020-03-01 | `versions()` added dotnet, typings fix |
| 4.22.3 | 2020-02-20 | `memLayout()` code cleanup | | 4.22.3 | 2020-02-20 | `memLayout()` code cleanup |
@ -550,7 +551,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| 3.23.3 | 2017-06-23 | updated docs | | 3.23.3 | 2017-06-23 | updated docs |
| 3.23.2 | 2017-06-23 | bug fix `battery` (windows) | | 3.23.2 | 2017-06-23 | bug fix `battery` (windows) |
| 3.23.1 | 2017-06-22 | updated docs | | 3.23.1 | 2017-06-22 | updated docs |
| 3.23.0 | 2017-06-22 | added `memLayout`, `diskLayout`, extended windows support (`inetChecksite`)| | 3.23.0 | 2017-06-22 | added `memLayout`, `diskLayout`, extended windows support (`inetChecksite`) |
| 3.22.0 | 2017-06-19 | extended windows support (`users`, `inetLatency`) | | 3.22.0 | 2017-06-19 | extended windows support (`users`, `inetLatency`) |
| 3.21.0 | 2017-06-18 | extended time (timezone), extended windows support (battery, getAll...) | | 3.21.0 | 2017-06-18 | extended time (timezone), extended windows support (battery, getAll...) |
| 3.20.1 | 2017-06-17 | updated docs | | 3.20.1 | 2017-06-17 | updated docs |
@ -560,7 +561,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
| 3.17.3 | 2017-04-29 | minor fix (blockDevices data array, Windows) | | 3.17.3 | 2017-04-29 | minor fix (blockDevices data array, Windows) |
| 3.17.2 | 2017-04-24 | minor fix (removed console.log) | | 3.17.2 | 2017-04-24 | minor fix (removed console.log) |
| 3.17.1 | 2017-04-23 | fixed bugs fsSize(win), si.processes (command), si.osinfo(win) | | 3.17.1 | 2017-04-23 | fixed bugs fsSize(win), si.processes (command), si.osinfo(win) |
| 3.17.0 | 2017-02-19 | windows support for some first functions, extended process list (linux)| | 3.17.0 | 2017-02-19 | windows support for some first functions, extended process list (linux) |
| 3.16.0 | 2017-01-19 | blockDevices: added removable attribute + fix | | 3.16.0 | 2017-01-19 | blockDevices: added removable attribute + fix |
| 3.15.1 | 2017-01-17 | minor cpuTemperature fix (OSX) | | 3.15.1 | 2017-01-17 | minor cpuTemperature fix (OSX) |
| 3.15.0 | 2017-01-15 | added cpuTemperature also for OSX | | 3.15.0 | 2017-01-15 | added cpuTemperature also for OSX |

View File

@ -208,7 +208,7 @@ Full function reference with examples can be found at [https://systeminformation
| | governor | X | | | | | e.g. 'powersave' | | | governor | X | | | | | e.g. 'powersave' |
| | cores | X | X | X | X | | # cores | | | cores | X | X | X | X | | # cores |
| | physicalCores | X | X | X | X | | # physical cores | | | physicalCores | X | X | X | X | | # physical cores |
| | efficiencyCores | X | | X | | | # efficiancy cores | | | efficiencyCores | X | | X | | | # efficiency cores |
| | performanceCores | X | | X | | | # performance cores | | | performanceCores | X | | X | | | # performance cores |
| | processors | X | X | X | X | | # processors | | | processors | X | X | X | X | | # processors |
| | socket | X | X | | X | | socket type e.g. "LGA1356" | | | socket | X | X | | X | | socket type e.g. "LGA1356" |

View File

@ -57,6 +57,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr>
<th scope="row">5.12.7</th>
<td>2022-10-15</td>
<td><span class="code">versions()</span> fix postgres</td>
</tr>
<tr> <tr>
<th scope="row">5.12.6</th> <th scope="row">5.12.6</th>
<td>2022-08-18</td> <td>2022-08-18</td>

View File

@ -170,7 +170,7 @@
<img class="logo" src="assets/logo.png" alt="logo"> <img class="logo" src="assets/logo.png" alt="logo">
<div class="title">systeminformation</div> <div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span>&nbsp;</div> <div class="subtitle"><span id="typed"></span>&nbsp;</div>
<div class="version">New Version: <span id="version">5.12.6</span></div> <div class="version">New Version: <span id="version">5.12.7</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> <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>
<div class="down"> <div class="down">
@ -214,7 +214,7 @@
<div class="title">Downloads last month</div> <div class="title">Downloads last month</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">
<div class="numbers">583</div> <div class="numbers">585</div>
<div class="title">Dependents</div> <div class="title">Dependents</div>
</div> </div>
</div> </div>

View File

@ -16,7 +16,6 @@
const exec = require('child_process').exec; const exec = require('child_process').exec;
const execSync = require('child_process').execSync; const execSync = require('child_process').execSync;
const util = require('./util'); const util = require('./util');
// const fs = require('fs');
let _platform = process.platform; let _platform = process.platform;
@ -79,7 +78,6 @@ function parseLinuxAudioPciMM(lines, audioPCI) {
result.id = slotId; result.id = slotId;
result.name = util.getValue(lines, 'SDevice'); result.name = util.getValue(lines, 'SDevice');
// result.type = util.getValue(lines, 'Class');
result.manufacturer = util.getValue(lines, 'SVendor'); result.manufacturer = util.getValue(lines, 'SVendor');
result.revision = util.getValue(lines, 'Rev'); result.revision = util.getValue(lines, 'Rev');
result.driver = pciMatch && pciMatch.length === 1 && pciMatch[0].driver ? pciMatch[0].driver : ''; result.driver = pciMatch && pciMatch.length === 1 && pciMatch[0].driver ? pciMatch[0].driver : '';
@ -128,7 +126,6 @@ function parseDarwinAudio(audioObject, id) {
function parseWindowsAudio(lines) { function parseWindowsAudio(lines) {
const result = {}; const result = {};
const status = util.getValue(lines, 'StatusInfo', ':'); const status = util.getValue(lines, 'StatusInfo', ':');
// const description = util.getValue(lines, 'Description', ':');
result.id = util.getValue(lines, 'DeviceID', ':'); // PNPDeviceID?? result.id = util.getValue(lines, 'DeviceID', ':'); // PNPDeviceID??
result.name = util.getValue(lines, 'name', ':'); result.name = util.getValue(lines, 'name', ':');

View File

@ -51,7 +51,7 @@ function parseWinBatteryPart(lines, designedCapacity, fullChargeCapacity) {
result.capacityUnit = 'mWh'; result.capacityUnit = 'mWh';
result.percent = parseInt(util.getValue(lines, 'EstimatedChargeRemaining', ':') || 0); result.percent = parseInt(util.getValue(lines, 'EstimatedChargeRemaining', ':') || 0);
result.currentCapacity = parseInt(result.maxCapacity * result.percent / 100); result.currentCapacity = parseInt(result.maxCapacity * result.percent / 100);
result.isCharging = (statusValue >= 6 && statusValue <= 9) || statusValue === 11 || (!(statusValue === 3) && !(statusValue === 1) && result.percent < 100); result.isCharging = (statusValue >= 6 && statusValue <= 9) || statusValue === 11 || ((statusValue !== 3) && (statusValue !== 1) && result.percent < 100);
result.acConnected = result.isCharging || statusValue === 2; result.acConnected = result.isCharging || statusValue === 2;
result.model = util.getValue(lines, 'DeviceID', ':'); result.model = util.getValue(lines, 'DeviceID', ':');
} else { } else {
@ -232,7 +232,6 @@ module.exports = function (callback) {
workload workload
).then(data => { ).then(data => {
if (data) { if (data) {
// let parts = data.results[0].split(/\n\s*\n/);
let parts = data.results[0].split(/\n\s*\n/); let parts = data.results[0].split(/\n\s*\n/);
let batteries = []; let batteries = [];
const hasValue = value => /\S/.test(value); const hasValue = value => /\S/.test(value);

View File

@ -617,14 +617,6 @@ function getCpu() {
cpuFlags().then(flags => { cpuFlags().then(flags => {
result.flags = flags; result.flags = flags;
result.virtualization = flags.indexOf('vmx') > -1 || flags.indexOf('svm') > -1; result.virtualization = flags.indexOf('vmx') > -1 || flags.indexOf('svm') > -1;
// if (_windows) {
// try {
// const systeminfo = execSync('systeminfo', util.execOptsWin).toString();
// result.virtualization = result.virtualization || (systeminfo.indexOf('Virtualization Enabled In Firmware: Yes') !== -1) || (systeminfo.indexOf('Virtualisierung in Firmware aktiviert: Ja') !== -1) || (systeminfo.indexOf('Virtualisation activée dans le microprogramme : Qiu') !== -1);
// } catch (e) {
// util.noop();
// }
// }
if (_darwin) { if (_darwin) {
exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily', function (error, stdout) { exec('sysctl machdep.cpu hw.cpufrequency_max hw.cpufrequency_min hw.packages hw.physicalcpu_max hw.ncpu hw.tbfrequency hw.cpufamily hw.cpusubfamily', function (error, stdout) {
let lines = stdout.toString().split('\n'); let lines = stdout.toString().split('\n');
@ -695,12 +687,9 @@ function getCpu() {
result = cpuBrandManufacturer(result); result = cpuBrandManufacturer(result);
result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id')); result.vendor = cpuManufacturer(util.getValue(lines, 'vendor id'));
// if (!result.vendor) { result.vendor = util.getValue(lines, 'anbieterkennung'); }
result.family = util.getValue(lines, 'cpu family'); result.family = util.getValue(lines, 'cpu family');
// if (!result.family) { result.family = util.getValue(lines, 'prozessorfamilie'); }
result.model = util.getValue(lines, 'model:'); result.model = util.getValue(lines, 'model:');
// if (!result.model) { result.model = util.getValue(lines, 'modell:'); }
result.stepping = util.getValue(lines, 'stepping'); result.stepping = util.getValue(lines, 'stepping');
result.revision = util.getValue(lines, 'cpu revision'); result.revision = util.getValue(lines, 'cpu revision');
result.cache.l1d = util.getValue(lines, 'l1d cache'); result.cache.l1d = util.getValue(lines, 'l1d cache');
@ -713,11 +702,9 @@ function getCpu() {
if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3) * (result.cache.l3.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l3.indexOf('K') !== -1 ? 1024 : 1)); } if (result.cache.l3) { result.cache.l3 = parseInt(result.cache.l3) * (result.cache.l3.indexOf('M') !== -1 ? 1024 * 1024 : (result.cache.l3.indexOf('K') !== -1 ? 1024 : 1)); }
const threadsPerCore = util.getValue(lines, 'thread(s) per core') || '1'; const threadsPerCore = util.getValue(lines, 'thread(s) per core') || '1';
// const coresPerSocketInt = parseInt(util.getValue(lines, 'cores(s) per socket') || '1', 10);
const processors = util.getValue(lines, 'socket(s)') || '1'; const processors = util.getValue(lines, 'socket(s)') || '1';
let threadsPerCoreInt = parseInt(threadsPerCore, 10); // threads per code (normally only for performance cores) let threadsPerCoreInt = parseInt(threadsPerCore, 10); // threads per code (normally only for performance cores)
let processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1) let processorsInt = parseInt(processors, 10) || 1; // number of sockets / processor units in machine (normally 1)
// const cpus = (parseInt(util.getValue(lines, 'cpu(s)'), 10) || 1); // overall number of cores (e.g. 24 on i12900)
const coresPerSocket = parseInt(util.getValue(lines, 'core(s) per socket'), 10); // number of cores (e.g. 16 on i12900) const coresPerSocket = parseInt(util.getValue(lines, 'core(s) per socket'), 10); // number of cores (e.g. 16 on i12900)
result.physicalCores = coresPerSocket ? coresPerSocket * processorsInt : result.cores / threadsPerCoreInt; result.physicalCores = coresPerSocket ? coresPerSocket * processorsInt : result.cores / threadsPerCoreInt;
result.performanceCores = threadsPerCoreInt > 1 ? result.cores - result.physicalCores : result.cores; result.performanceCores = threadsPerCoreInt > 1 ? result.cores - result.physicalCores : result.cores;
@ -779,7 +766,7 @@ function getCpu() {
result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer')); result.vendor = cpuManufacturer(util.getValue(lines, 'manufacturer'));
let sig = util.getValue(lines, 'signature'); let sig = util.getValue(lines, 'signature');
sig = sig.split(','); sig = sig.split(',');
for (var i = 0; i < sig.length; i++) { for (let i = 0; i < sig.length; i++) {
sig[i] = sig[i].trim(); sig[i] = sig[i].trim();
} }
result.family = util.getValue(sig, 'Family', ' ', true); result.family = util.getValue(sig, 'Family', ' ', true);
@ -825,7 +812,6 @@ function getCpu() {
const workload = []; const workload = [];
workload.push(util.powerShell('Get-WmiObject Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl')); workload.push(util.powerShell('Get-WmiObject Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl'));
workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl')); workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl'));
// workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent')); workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
Promise.all( Promise.all(
@ -915,9 +901,6 @@ function getCpu() {
result.cache.l1d = parseInt(installedSize, 10) / 2; result.cache.l1d = parseInt(installedSize, 10) / 2;
} }
}); });
// lines = data[2].split('\r\n');
// result.virtualization = (util.getValue(lines, 'HyperVRequirementVirtualizationFirmwareEnabled').toLowerCase() === 'true');
// result.virtualization = (util.getValue(lines, 'HyperVisorPresent').toLowerCase() === 'true');
const hyperv = data[2] ? data[2].toString().toLowerCase() : ''; const hyperv = data[2] ? data[2].toString().toLowerCase() : '';
result.virtualization = hyperv.indexOf('true') !== -1; result.virtualization = hyperv.indexOf('true') !== -1;
@ -1067,9 +1050,7 @@ function cpuTemperature(callback) {
}); });
if (result.cores.length > 0) { if (result.cores.length > 0) {
// if (result.main === null) {
result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length); result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
// }
let maxtmp = Math.max.apply(Math, result.cores); let maxtmp = Math.max.apply(Math, result.cores);
result.max = (maxtmp > result.main) ? maxtmp : result.main; result.max = (maxtmp > result.main) ? maxtmp : result.main;
} }
@ -1123,9 +1104,7 @@ function cpuTemperature(callback) {
} }
}); });
if (result.cores.length > 0) { if (result.cores.length > 0) {
// if (result.main === null) {
result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length); result.main = Math.round(result.cores.reduce((a, b) => a + b, 0) / result.cores.length);
// }
let maxtmp = Math.max.apply(Math, result.cores); let maxtmp = Math.max.apply(Math, result.cores);
result.max = (maxtmp > result.main) ? maxtmp : result.main; result.max = (maxtmp > result.main) ? maxtmp : result.main;
} else { } else {
@ -1702,8 +1681,6 @@ function getFullLoad() {
let totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser; let totalTicks = totalIdle + totalIrq + totalNice + totalSystem + totalUser;
result = (totalTicks - totalIdle) / totalTicks * 100.0; result = (totalTicks - totalIdle) / totalTicks * 100.0;
} else {
result = 0;
} }
resolve(result); resolve(result);
}); });

View File

@ -331,8 +331,6 @@ function osInfo(callback) {
try { try {
const workload = []; const workload = [];
workload.push(util.powerShell('Get-WmiObject Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl')); workload.push(util.powerShell('Get-WmiObject Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl'));
// workload.push(execPromise('systeminfo', util.execOptsWin));
// workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent')); 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(
@ -344,10 +342,6 @@ function osInfo(callback) {
result.build = util.getValue(lines, 'BuildNumber', ':').trim(); result.build = util.getValue(lines, 'BuildNumber', ':').trim();
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() : '';
// 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') : [];
// result.hypervisor = (util.getValue(hyperv, 'HyperVisorPresent').toLowerCase() === 'true');
const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : ''; const hyperv = data.results[1] ? data.results[1].toString().toLowerCase() : '';
result.hypervisor = hyperv.indexOf('true') !== -1; result.hypervisor = hyperv.indexOf('true') !== -1;
const term = data.results[2] ? data.results[2].toString() : ''; const term = data.results[2] ? data.results[2].toString() : '';
@ -740,7 +734,6 @@ function versions(apps, callback) {
} }
functionProcessed(); functionProcessed();
}); });
functionProcessed();
} }
}); });
} else { } else {
@ -1003,17 +996,21 @@ function versions(apps, callback) {
} }
} }
if ({}.hasOwnProperty.call(appsObj.versions, 'dotnet')) { if ({}.hasOwnProperty.call(appsObj.versions, 'dotnet')) {
if (_windows) {
util.powerShell('gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release').then(stdout => { util.powerShell('gci "HKLM:\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP" -recurse | gp -name Version,Release -EA 0 | where { $_.PSChildName -match "^(?!S)\\p{L}"} | select PSChildName, Version, Release').then(stdout => {
const lines = stdout.toString().split('\r\n'); const lines = stdout.toString().split('\r\n');
let dotnet = ''; let dotnet = '';
lines.forEach(line => { lines.forEach(line => {
line = line.replace(/ +/g, ' '); line = line.replace(/ +/g, ' ');
const parts = line.split(' '); const parts = line.split(' ');
dotnet = dotnet || ((parts[0].toLowerCase().startsWith('client') && parts.length > 2 ? parts[1].trim() : (parts[0].toLowerCase().startsWith('full') && parts.length > 2 ? parts[1].trim() : ''))); dotnet = dotnet || (parts[0].toLowerCase().startsWith('client') && parts.length > 2 ? parts[1].trim() : (parts[0].toLowerCase().startsWith('full') && parts.length > 2 ? parts[1].trim() : ''));
}); });
appsObj.versions.dotnet = dotnet.trim(); appsObj.versions.dotnet = dotnet.trim();
functionProcessed(); functionProcessed();
}); });
} else {
functionProcessed();
}
} }
} catch (e) { } catch (e) {
if (callback) { callback(appsObj.versions); } if (callback) { callback(appsObj.versions); }
@ -1140,7 +1137,6 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32'; sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32';
} }
util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => { util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
// let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/);
let lines = stdout.split('\r\n'); let lines = stdout.split('\r\n');
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase(); result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) { exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) {