From 1b62892f863aac25245fcbb6d0e5b2967c309312 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Mon, 18 Sep 2023 06:02:46 +0200 Subject: [PATCH] baseboard() improved parsing (windows) --- CHANGELOG.md | 1 + docs/history.html | 5 +++++ docs/index.html | 4 ++-- lib/system.js | 14 ++++++-------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d723ea..14e8c23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | ------- | ---------- | --------------------------------------------------------------------------------------------------- | +| 5.21.6 | 2023-09-16 | `baseboard()` improved parsing (windows) | | 5.21.5 | 2023-09-15 | `chassis()`, `baseboard()` improved parsing (windows) | | 5.21.4 | 2023-09-02 | `wifiConnections()` fixed when no wifi chip (macOS) | | 5.21.3 | 2023-08-31 | `cpuTemperature()` improved parsing for AMD (linux) | diff --git a/docs/history.html b/docs/history.html index 08f5450..dd36140 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@ + + 5.21.6 + 2023-09-18 + baseboard() improved parsing (windows) + 5.21.5 2023-09-15 diff --git a/docs/index.html b/docs/index.html index 8bb2486..b36c005 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.21.5
+
New Version: 5.21.6
@@ -212,7 +212,7 @@
Downloads last month
-
645
+
646
Dependents
diff --git a/lib/system.js b/lib/system.js index d8f897d..08354d5 100644 --- a/lib/system.js +++ b/lib/system.js @@ -318,10 +318,11 @@ function system(callback) { exports.system = system; function cleanDefaults(s) { - if (s === 'Default string') { s = ''; } - if (s.toLowerCase().indexOf('o.e.m.') !== -1) { s = ''; } - - return s + const cmpStr = s.toLowerCase(); + if (cmpStr.indexOf('o.e.m.') === -1 && cmpStr.indexOf('default string') === -1 && cmpStr !== 'default') { + return s || ''; + } + return ''; } function bios(callback) { @@ -561,7 +562,7 @@ function baseboard(callback) { const workload = []; const win10plus = parseInt(os.release()) >= 10; const maxCapacityAttribute = win10plus ? 'MaxCapacityEx' : 'MaxCapacity'; - workload.push(util.powerShell('Get-CimInstance Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU,SMBIOSAssetTag | fl')); + workload.push(util.powerShell('Get-CimInstance Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU | fl')); workload.push(util.powerShell(`Get-CimInstance Win32_physicalmemoryarray | select ${maxCapacityAttribute}, MemoryDevices | fl`)); util.promiseAll( workload @@ -579,9 +580,6 @@ function baseboard(callback) { if (!result.assetTag) { result.assetTag = cleanDefaults(util.getValue(lines, 'sku', ':')); } - if (!result.assetTag) { - result.assetTag = cleanDefaults(util.getValue(lines, 'SMBIOSAssetTag', ':')); - } // memphysical lines = data.results[1] ? data.results[1].toString().split('\r\n') : [''];