systeminformation 5.11.0 → 5.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,7 @@
30
30
  [![Sponsoring][sponsor-badge]][sponsor-url]
31
31
  [![MIT license][license-img]][license-url]
32
32
 
33
- This is amazing. Started as a small project just for myself, it now has > 10,000 lines of code, > 450 versions published, up to 4 mio downloads per month, > 50 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
33
+ This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 500 versions published, up to 4 mio downloads per month, > 75 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
34
34
 
35
35
  ## New Version 5.0
36
36
 
@@ -919,13 +919,15 @@ e.g. on DEBIAN based systems by running `sudo apt-get install lm-sensors`
919
919
 
920
920
  To be able to detect S.M.A.R.T. status on Linux you need to install `smartmontools`. On DEBIAN based Linux distributions you can install it by running `sudo apt-get install smartmontools`
921
921
 
922
+ #### Windows Encoding Issues
923
+ I now reimplemented all windows functions to avoid encoding problems (special chacarters). And as Windows 11 now droppend `wmic` support, I had to move completely to `powershell`. Be sure that powershell version 5+ is installed on your machine. On older Windows versions (7, 8) you might still see encoding problems due to the old powershell version.
922
924
  ## *: Additional Notes
923
925
 
924
926
  In `fsStats()`, `disksIO()` and `networkStats()` the results / sec. values (rx_sec, IOPS, ...) are calculated correctly beginning
925
927
  with the second call of the function. It is determined by calculating the difference of transferred bytes / IOs
926
928
  divided by the time between two calls of the function.
927
929
 
928
- The first time you are calling one of these functions, you will get `-1` for transfer rates. The second time, you should then get statistics based on the time between the two calls ...
930
+ The first time you are calling one of these functions, you will get `null` for transfer rates. The second time, you should then get statistics based on the time between the two calls ...
929
931
 
930
932
  So basically, if you e.g. need a value for network stats every second, your code should look like this:
931
933
 
@@ -1001,7 +1003,8 @@ NetBSD is a registered trademark of The NetBSD Foundation, Docker is a trademark
1001
1003
  Solaris, OpenSolaris and registered trademarks of Sun Microsystems, VMware is a trademark of VMware Inc,
1002
1004
  Virtual Box is a trademark of Oracle Corporation, Xen is a registered trademark of Xen Project,
1003
1005
  QEMU is a trademark of Fabrice Bellard, bochs is a trademark of The Bochs Project, USB and USB Logo
1004
- are trademarks of USB Implementation Forum, Bluetooth and Bluetooth Logo are trademarks of Bluetooth SIG.
1006
+ are trademarks of USB Implementation Forum, Bluetooth and Bluetooth Logo are trademarks of Bluetooth SIG,
1007
+ Android is a trademark of Google LLC.
1005
1008
 
1006
1009
  All other trademarks are the property of their respective owners.
1007
1010
 
package/lib/audio.js CHANGED
@@ -194,7 +194,7 @@ function audio(callback) {
194
194
  });
195
195
  }
196
196
  if (_windows) {
197
- util.powerShell('Get-WmiObject Win32_SoundDevice | fl *').then((stdout, error) => {
197
+ util.powerShell('Get-WmiObject Win32_SoundDevice | select DeviceID,StatusInfo,Name,Manufacturer | fl').then((stdout, error) => {
198
198
  if (!error) {
199
199
  const parts = stdout.toString().split(/\n\s*\n/);
200
200
  for (let i = 0; i < parts.length; i++) {
package/lib/battery.js CHANGED
@@ -225,7 +225,7 @@ module.exports = function (callback) {
225
225
  if (_windows) {
226
226
  try {
227
227
  const workload = [];
228
- workload.push(util.powerShell('Get-WmiObject Win32_Battery | fl *'));
228
+ workload.push(util.powerShell('Get-WmiObject Win32_Battery | select BatteryStatus, DesignCapacity, DesignVoltage, EstimatedChargeRemaining, DeviceID | fl'));
229
229
  workload.push(util.powerShell('(Get-WmiObject -Class BatteryStaticData -Namespace ROOT/WMI).DesignedCapacity'));
230
230
  workload.push(util.powerShell('(Get-WmiObject -Class BatteryFullChargedCapacity -Namespace ROOT/WMI).FullChargedCapacity'));
231
231
  util.promiseAll(
package/lib/bluetooth.js CHANGED
@@ -158,7 +158,7 @@ function bluetoothDevices(callback) {
158
158
  });
159
159
  }
160
160
  if (_windows) {
161
- util.powerShell('Get-WmiObject Win32_PNPEntity | fl *').then((stdout, error) => {
161
+ util.powerShell('Get-WmiObject Win32_PNPEntity | select PNPClass, Name, Manufacturer | fl').then((stdout, error) => {
162
162
  if (!error) {
163
163
  const parts = stdout.toString().split(/\n\s*\n/);
164
164
  for (let i = 0; i < parts.length; i++) {
package/lib/cpu.js CHANGED
@@ -797,8 +797,8 @@ function getCpu() {
797
797
  if (_windows) {
798
798
  try {
799
799
  const workload = [];
800
- workload.push(util.powerShell('Get-WmiObject Win32_processor | fl *'));
801
- workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl *'));
800
+ workload.push(util.powerShell('Get-WmiObject Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl'));
801
+ workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl'));
802
802
  // workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
803
803
  workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
804
804
 
@@ -1425,7 +1425,7 @@ function cpuCache(callback) {
1425
1425
  }
1426
1426
  if (_windows) {
1427
1427
  try {
1428
- util.powerShell('Get-WmiObject Win32_processor | fl *').then((stdout, error) => {
1428
+ util.powerShell('Get-WmiObject Win32_processor | select L2CacheSize, L3CacheSize | fl').then((stdout, error) => {
1429
1429
  if (!error) {
1430
1430
  let lines = stdout.split('\r\n');
1431
1431
  result.l1d = 0;
@@ -1435,7 +1435,7 @@ function cpuCache(callback) {
1435
1435
  if (result.l2) { result.l2 = parseInt(result.l2, 10) * 1024; }
1436
1436
  if (result.l3) { result.l3 = parseInt(result.l3, 10) * 1024; }
1437
1437
  }
1438
- util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl ').then((stdout, error) => {
1438
+ util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl').then((stdout, error) => {
1439
1439
  if (!error) {
1440
1440
  const parts = stdout.split(/\n\s*\n/);
1441
1441
  parts.forEach(function (part) {
package/lib/filesystem.js CHANGED
@@ -127,7 +127,7 @@ function fsSize(callback) {
127
127
  if (_windows) {
128
128
  try {
129
129
  // util.wmic('logicaldisk get Caption,FileSystem,FreeSpace,Size').then((stdout) => {
130
- util.powerShell('Get-WmiObject Win32_logicaldisk | fl *').then((stdout, error) => {
130
+ util.powerShell('Get-WmiObject Win32_logicaldisk | select Caption,FileSystem,FreeSpace,Size | fl').then((stdout, error) => {
131
131
  if (!error) {
132
132
  let devices = stdout.toString().split(/\n\s*\n/);
133
133
  devices.forEach(function (device) {
@@ -400,7 +400,8 @@ function blockDevices(callback) {
400
400
  let drivetypes = ['Unknown', 'NoRoot', 'Removable', 'Local', 'Network', 'CD/DVD', 'RAM'];
401
401
  try {
402
402
  // util.wmic('logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /value').then((stdout, error) => {
403
- util.powerShell('Get-CimInstance -ClassName Win32_LogicalDisk | Format-List *').then((stdout, error) => {
403
+ // util.powerShell('Get-WmiObject Win32_logicaldisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl').then((stdout, error) => {
404
+ util.powerShell('Get-CimInstance -ClassName Win32_LogicalDisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl').then((stdout, error) => {
404
405
  if (!error) {
405
406
  let devices = stdout.toString().split(/\n\s*\n/);
406
407
  devices.forEach(function (device) {
@@ -1167,8 +1168,8 @@ function diskLayout(callback) {
1167
1168
  if (_windows) {
1168
1169
  try {
1169
1170
  const workload = [];
1170
- workload.push(util.powerShell('Get-WmiObject Win32_DiskDrive | fl *'));
1171
- workload.push(util.powerShell('Get-PhysicalDisk | Format-List'));
1171
+ workload.push(util.powerShell('Get-WmiObject Win32_DiskDrive | select Caption,Size,Status,PNPDeviceId,BytesPerSector,TotalCylinders,TotalHeads,TotalSectors,TotalTracks,TracksPerCylinder,SectorsPerTrack,FirmwareRevision,SerialNumber,InterfaceType | fl'));
1172
+ workload.push(util.powerShell('Get-PhysicalDisk | select BusType,MediaType,FriendlyName,Model,SerialNumber,Size | fl'));
1172
1173
  if (util.smartMonToolsInstalled()) {
1173
1174
  try {
1174
1175
  const smartDev = JSON.parse(execSync('smartctl --scan -j'));
package/lib/memory.js CHANGED
@@ -504,7 +504,7 @@ function memLayout(callback) {
504
504
  const FormFactors = 'Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA'.split('|');
505
505
 
506
506
  try {
507
- util.powerShell('Get-WmiObject Win32_PhysicalMemory | fl *').then((stdout, error) => {
507
+ util.powerShell('Get-WmiObject Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage | fl').then((stdout, error) => {
508
508
  if (!error) {
509
509
  let devices = stdout.toString().split(/\n\s*\n/);
510
510
  devices.shift();
package/lib/network.js CHANGED
@@ -1306,7 +1306,7 @@ function networkStatsSingle(iface) {
1306
1306
  let ifaceName = ifaceSanitized;
1307
1307
 
1308
1308
  // Performance Data
1309
- util.powerShell('Get-WmiObject Win32_PerfRawData_Tcpip_NetworkInterface | fl *').then((stdout, error) => {
1309
+ util.powerShell('Get-WmiObject Win32_PerfRawData_Tcpip_NetworkInterface | select Name,BytesReceivedPersec,PacketsReceivedErrors,PacketsReceivedDiscarded,BytesSentPersec,PacketsOutboundErrors,PacketsOutboundDiscarded | fl').then((stdout, error) => {
1310
1310
  if (!error) {
1311
1311
  const psections = stdout.toString().split(/\n\s*\n/);
1312
1312
  perfData = parseLinesWindowsPerfData(psections);
package/lib/osinfo.js CHANGED
@@ -167,7 +167,7 @@ function getLogoFile(distro) {
167
167
 
168
168
  function getFQDN() {
169
169
  let fqdn = os.hostname;
170
- if (_linux || _darwin || _freebsd || _openbsd || _netbsd) {
170
+ if (_linux || _darwin) {
171
171
  try {
172
172
  const stdout = execSync('hostname -f');
173
173
  fqdn = stdout.toString().split(os.EOL)[0];
@@ -175,6 +175,14 @@ function getFQDN() {
175
175
  util.noop();
176
176
  }
177
177
  }
178
+ if (_freebsd || _openbsd || _netbsd) {
179
+ try {
180
+ const stdout = execSync('hostname');
181
+ fqdn = stdout.toString().split(os.EOL)[0];
182
+ } catch (e) {
183
+ util.noop();
184
+ }
185
+ }
178
186
  if (_windows) {
179
187
  try {
180
188
  const stdout = execSync('echo %COMPUTERNAME%.%USERDNSDOMAIN%', util.execOptsWin);
@@ -322,7 +330,7 @@ function osInfo(callback) {
322
330
  result.release = result.kernel;
323
331
  try {
324
332
  const workload = [];
325
- workload.push(util.powerShell('Get-WmiObject Win32_OperatingSystem | fl *'));
333
+ workload.push(util.powerShell('Get-WmiObject Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl'));
326
334
  // workload.push(execPromise('systeminfo', util.execOptsWin));
327
335
  // workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"'));
328
336
  workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent'));
@@ -737,7 +745,7 @@ function versions(apps, callback) {
737
745
  });
738
746
  } else {
739
747
  if (_windows) {
740
- util.powerShell('Get-WmiObject Win32_Service | fl *').then((stdout) => {
748
+ util.powerShell('Get-WmiObject Win32_Service | select caption | fl').then((stdout) => {
741
749
  let serviceSections = stdout.split(/\n\s*\n/);
742
750
  for (let i = 0; i < serviceSections.length; i++) {
743
751
  if (serviceSections[i].trim() !== '') {
@@ -1132,7 +1140,7 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
1132
1140
  if (process.arch === 'ia32' && Object.prototype.hasOwnProperty.call(process.env, 'PROCESSOR_ARCHITEW6432')) {
1133
1141
  sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32';
1134
1142
  }
1135
- util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | fl *').then((stdout) => {
1143
+ util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
1136
1144
  // let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/);
1137
1145
  let lines = stdout.split('\r\n');
1138
1146
  result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
package/lib/printer.js CHANGED
@@ -186,7 +186,7 @@ function printer(callback) {
186
186
  });
187
187
  }
188
188
  if (_windows) {
189
- util.powerShell('Get-WmiObject Win32_Printer | fl *').then((stdout, error) => {
189
+ util.powerShell('Get-WmiObject Win32_Printer | select PrinterStatus,Name,DriverName,Local,Default,Shared | fl').then((stdout, error) => {
190
190
  if (!error) {
191
191
  const parts = stdout.toString().split(/\n\s*\n/);
192
192
  for (let i = 0; i < parts.length; i++) {
package/lib/processes.js CHANGED
@@ -332,7 +332,7 @@ function services(srv, callback) {
332
332
  }
333
333
  wincommand = `${wincommand.slice(0, -4)}"`;
334
334
  }
335
- wincommand += ' | fl *';
335
+ wincommand += ' | select Name,Caption,Started,StartMode,ProcessId | fl';
336
336
  util.powerShell(wincommand).then((stdout, error) => {
337
337
  if (!error) {
338
338
  let serviceSections = stdout.split(/\n\s*\n/);
@@ -797,7 +797,7 @@ function processes(callback) {
797
797
  });
798
798
  } else if (_windows) {
799
799
  try {
800
- util.powerShell('Get-WmiObject Win32_Process | fl *').then((stdout, error) => {
800
+ util.powerShell('Get-WmiObject Win32_Process | select ProcessId,ParentProcessId,ExecutionState,Caption,CommandLine,ExecutablePath,UserModeTime,KernelModeTime,WorkingSetSize,Priority,PageFileUsage,CreationDate | fl').then((stdout, error) => {
801
801
  if (!error) {
802
802
  let processSections = stdout.split(/\n\s*\n/);
803
803
  let procs = [];
@@ -969,7 +969,7 @@ function processLoad(proc, callback) {
969
969
  if (procSanitized && processes.length && processes[0] !== '------') {
970
970
  if (_windows) {
971
971
  try {
972
- util.powerShell('Get-WmiObject Win32_Process | fl *').then((stdout, error) => {
972
+ util.powerShell('Get-WmiObject Win32_Process | select ProcessId,Caption,UserModeTime,KernelModeTime,WorkingSetSize | fl').then((stdout, error) => {
973
973
  if (!error) {
974
974
  let processSections = stdout.split(/\n\s*\n/);
975
975
  let procStats = [];
package/lib/system.js CHANGED
@@ -343,7 +343,7 @@ function system(callback) {
343
343
  }
344
344
  if (_windows) {
345
345
  try {
346
- util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | fl *').then((stdout, error) => {
346
+ util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | select Name,Vendor,Version,IdentifyingNumber,UUID | fl').then((stdout, error) => {
347
347
  if (!error) {
348
348
  // let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0)[0].trim().split(/\s\s+/);
349
349
  let lines = stdout.split('\r\n');
@@ -369,7 +369,7 @@ function system(callback) {
369
369
  if (manufacturer.startsWith('xen')) { result.virtualHost = 'Xen'; }
370
370
  if (manufacturer.startsWith('qemu')) { result.virtualHost = 'KVM'; }
371
371
  }
372
- util.powerShell('Get-WmiObject MS_Systeminformation -Namespace "root/wmi" | fl *').then((stdout, error) => {
372
+ util.powerShell('Get-WmiObject MS_Systeminformation -Namespace "root/wmi" | select systemsku | fl ').then((stdout, error) => {
373
373
  if (!error) {
374
374
  let lines = stdout.split('\r\n');
375
375
  result.sku = util.getValue(lines, 'systemsku', ':');
@@ -506,7 +506,7 @@ function bios(callback) {
506
506
  }
507
507
  if (_windows) {
508
508
  try {
509
- util.powerShell('Get-WmiObject Win32_bios | fl *').then((stdout, error) => {
509
+ util.powerShell('Get-WmiObject Win32_bios | select Description,Version,Manufacturer,ReleaseDate,BuildNumber,SerialNumber | fl').then((stdout, error) => {
510
510
  if (!error) {
511
511
  let lines = stdout.toString().split('\r\n');
512
512
  const description = util.getValue(lines, 'description', ':');
@@ -662,7 +662,7 @@ function baseboard(callback) {
662
662
  if (_windows) {
663
663
  try {
664
664
  const workload = [];
665
- workload.push(util.powerShell('Get-WmiObject Win32_baseboard | fl *'));
665
+ workload.push(util.powerShell('Get-WmiObject Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU | fl'));
666
666
  workload.push(util.powerShell('Get-WmiObject Win32_physicalmemoryarray | select MaxCapacity, MemoryDevices | fl'));
667
667
  util.promiseAll(
668
668
  workload
@@ -795,7 +795,7 @@ function chassis(callback) {
795
795
  }
796
796
  if (_windows) {
797
797
  try {
798
- util.powerShell('Get-WmiObject Win32_SystemEnclosure | fl *').then((stdout, error) => {
798
+ util.powerShell('Get-WmiObject Win32_SystemEnclosure | select Model,Manufacturer,ChassisTypes,Version,SerialNumber,PartNumber,SKU | fl').then((stdout, error) => {
799
799
  if (!error) {
800
800
  let lines = stdout.toString().split('\r\n');
801
801
 
package/lib/usb.js CHANGED
@@ -263,7 +263,7 @@ function usb(callback) {
263
263
  });
264
264
  }
265
265
  if (_windows) {
266
- util.powerShell('Get-WmiObject CIM_LogicalDevice | where { $_.Description -match "USB"}').then((stdout, error) => {
266
+ util.powerShell('Get-WmiObject CIM_LogicalDevice | where { $_.Description -match "USB"} | select Name,CreationClassName,DeviceId,Manufacturer | fl').then((stdout, error) => {
267
267
  if (!error) {
268
268
  const parts = stdout.toString().split(/\n\s*\n/);
269
269
  for (let i = 0; i < parts.length; i++) {
package/lib/users.js CHANGED
@@ -253,8 +253,8 @@ function users(callback) {
253
253
  // Promise.all(
254
254
  // workload
255
255
  // ).then(data => {
256
- let cmd = 'Get-WmiObject Win32_LogonSession | fl *' + '; echo \'#-#-#-#\';';
257
- cmd += 'Get-WmiObject Win32_LoggedOnUser | fl *' + '; echo \'#-#-#-#\';';
256
+ let cmd = 'Get-WmiObject Win32_LogonSession | select LogonId,StartTime | fl' + '; echo \'#-#-#-#\';';
257
+ cmd += 'Get-WmiObject Win32_LoggedOnUser | select antecedent,dependent | fl ' + '; echo \'#-#-#-#\';';
258
258
  cmd += 'Get-WmiObject Win32_Process -Filter "name=\'explorer.exe\'" | Select @{Name="sessionid";Expression={$_.SessionId}}, @{Name="domain";Expression={$_.GetOwner().Domain}}, @{Name="username";Expression={$_.GetOwner().User}} | fl' + '; echo \'#-#-#-#\';';
259
259
  cmd += 'query user';
260
260
  util.powerShell(cmd).then(data => {
package/lib/util.js CHANGED
@@ -396,7 +396,7 @@ function powerShellProceedResults(data) {
396
396
  }
397
397
 
398
398
  function powerShellStart() {
399
- _psChild = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
399
+ _psChild = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-Command', '-'], {
400
400
  stdio: 'pipe',
401
401
  windowsHide: true,
402
402
  maxBuffer: 1024 * 20000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.11.0",
3
+ "version": "5.11.4",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",