systeminformation 5.9.5 → 5.9.9

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.
@@ -321,7 +321,7 @@ class DockerSocket {
321
321
  } catch (err) {
322
322
  callback({});
323
323
  }
324
- }
324
+ }
325
325
  }
326
326
 
327
327
  module.exports = DockerSocket;
package/lib/filesystem.js CHANGED
@@ -395,25 +395,26 @@ function blockDevices(callback) {
395
395
  if (_windows) {
396
396
  let drivetypes = ['Unknown', 'NoRoot', 'Removable', 'Local', 'Network', 'CD/DVD', 'RAM'];
397
397
  try {
398
- util.wmic('logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /value').then((stdout, error) => {
398
+ // util.wmic('logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /value').then((stdout, error) => {
399
+ util.powerShell('Get-CimInstance -ClassName Win32_LogicalDisk | Format-List *').then((stdout, error) => {
399
400
  if (!error) {
400
401
  let devices = stdout.toString().split(/\n\s*\n/);
401
402
  devices.forEach(function (device) {
402
403
  let lines = device.split('\r\n');
403
- let drivetype = util.getValue(lines, 'drivetype', '=');
404
+ let drivetype = util.getValue(lines, 'drivetype', ':');
404
405
  if (drivetype) {
405
406
  data.push({
406
- name: util.getValue(lines, 'name', '='),
407
- identifier: util.getValue(lines, 'caption', '='),
407
+ name: util.getValue(lines, 'name', ':'),
408
+ identifier: util.getValue(lines, 'caption', ':'),
408
409
  type: 'disk',
409
- fsType: util.getValue(lines, 'filesystem', '=').toLowerCase(),
410
- mount: util.getValue(lines, 'caption', '='),
411
- size: util.getValue(lines, 'size', '='),
410
+ fsType: util.getValue(lines, 'filesystem', ':').toLowerCase(),
411
+ mount: util.getValue(lines, 'caption', ':'),
412
+ size: util.getValue(lines, 'size', ':'),
412
413
  physical: (drivetype >= 0 && drivetype <= 6) ? drivetypes[drivetype] : drivetypes[0],
413
- uuid: util.getValue(lines, 'volumeserialnumber', '='),
414
- label: util.getValue(lines, 'volumename', '='),
414
+ uuid: util.getValue(lines, 'volumeserialnumber', ':'),
415
+ label: util.getValue(lines, 'volumename', ':'),
415
416
  model: '',
416
- serial: util.getValue(lines, 'volumeserialnumber', '='),
417
+ serial: util.getValue(lines, 'volumeserialnumber', ':'),
417
418
  removable: drivetype === '2',
418
419
  protocol: ''
419
420
  });
@@ -783,7 +784,7 @@ function diskLayout(callback) {
783
784
  { pattern: '^IC.+', manufacturer: 'Hitachi' },
784
785
  { pattern: '^HTS.+', manufacturer: 'Hitachi' },
785
786
  { pattern: '^SANDISK.+', manufacturer: 'SanDisk' },
786
- { pattern: '^KINGSTON.+', manufacturer: 'Kingston Technonogy' },
787
+ { pattern: '^KINGSTON.+', manufacturer: 'Kingston Technology' },
787
788
  { pattern: '^SONY.+', manufacturer: 'Sony' },
788
789
  { pattern: '^TRANSCEND.+', manufacturer: 'Transcend' },
789
790
  { pattern: 'SAMSUNG.+', manufacturer: 'Samsung' },
@@ -1162,7 +1163,7 @@ function diskLayout(callback) {
1162
1163
  if (_windows) {
1163
1164
  try {
1164
1165
  const workload = [];
1165
- workload.push(util.wmic('diskdrive get /value'));
1166
+ workload.push(util.powerShell('Get-WmiObject Win32_DiskDrive | fl *'));
1166
1167
  workload.push(util.powerShell('Get-PhysicalDisk | Format-List'));
1167
1168
  if (util.smartMonToolsInstalled()) {
1168
1169
  try {
@@ -1182,25 +1183,25 @@ function diskLayout(callback) {
1182
1183
  let devices = data.results[0].toString().split(/\n\s*\n/);
1183
1184
  devices.forEach(function (device) {
1184
1185
  let lines = device.split('\r\n');
1185
- const size = util.getValue(lines, 'Size', '=').trim();
1186
- const status = util.getValue(lines, 'Status', '=').trim().toLowerCase();
1186
+ const size = util.getValue(lines, 'Size', ':').trim();
1187
+ const status = util.getValue(lines, 'Status', ':').trim().toLowerCase();
1187
1188
  if (size) {
1188
1189
  result.push({
1189
- device: util.getValue(lines, 'PNPDeviceId', '='),
1190
+ device: util.getValue(lines, 'PNPDeviceId', ':'),
1190
1191
  type: device.indexOf('SSD') > -1 ? 'SSD' : 'HD', // just a starting point ... better: MSFT_PhysicalDisk - Media Type ... see below
1191
- name: util.getValue(lines, 'Caption', '='),
1192
- vendor: getVendorFromModel(util.getValue(lines, 'Caption', '=', true).trim()),
1192
+ name: util.getValue(lines, 'Caption', ':'),
1193
+ vendor: getVendorFromModel(util.getValue(lines, 'Caption', ':', true).trim()),
1193
1194
  size: parseInt(size),
1194
- bytesPerSector: parseInt(util.getValue(lines, 'BytesPerSector', '=')),
1195
- totalCylinders: parseInt(util.getValue(lines, 'TotalCylinders', '=')),
1196
- totalHeads: parseInt(util.getValue(lines, 'TotalHeads', '=')),
1197
- totalSectors: parseInt(util.getValue(lines, 'TotalSectors', '=')),
1198
- totalTracks: parseInt(util.getValue(lines, 'TotalTracks', '=')),
1199
- tracksPerCylinder: parseInt(util.getValue(lines, 'TracksPerCylinder', '=')),
1200
- sectorsPerTrack: parseInt(util.getValue(lines, 'SectorsPerTrack', '=')),
1201
- firmwareRevision: util.getValue(lines, 'FirmwareRevision', '=').trim(),
1202
- serialNum: util.getValue(lines, 'SerialNumber', '=').trim(),
1203
- interfaceType: util.getValue(lines, 'InterfaceType', '=').trim(),
1195
+ bytesPerSector: parseInt(util.getValue(lines, 'BytesPerSector', ':')),
1196
+ totalCylinders: parseInt(util.getValue(lines, 'TotalCylinders', ':')),
1197
+ totalHeads: parseInt(util.getValue(lines, 'TotalHeads', ':')),
1198
+ totalSectors: parseInt(util.getValue(lines, 'TotalSectors', ':')),
1199
+ totalTracks: parseInt(util.getValue(lines, 'TotalTracks', ':')),
1200
+ tracksPerCylinder: parseInt(util.getValue(lines, 'TracksPerCylinder', ':')),
1201
+ sectorsPerTrack: parseInt(util.getValue(lines, 'SectorsPerTrack', ':')),
1202
+ firmwareRevision: util.getValue(lines, 'FirmwareRevision', ':').trim(),
1203
+ serialNum: util.getValue(lines, 'SerialNumber', ':').trim(),
1204
+ interfaceType: util.getValue(lines, 'InterfaceType', ':').trim(),
1204
1205
  smartStatus: (status === 'ok' ? 'Ok' : (status === 'degraded' ? 'Degraded' : (status === 'pred fail' ? 'Predicted Failure' : 'Unknown'))),
1205
1206
  temperature: null,
1206
1207
  });
package/lib/graphics.js CHANGED
@@ -13,7 +13,6 @@
13
13
  // 7. Graphics (controller, display)
14
14
  // ----------------------------------------------------------------------------------
15
15
 
16
- const os = require('os');
17
16
  const fs = require('fs');
18
17
  const exec = require('child_process').exec;
19
18
  const execSync = require('child_process').execSync;
@@ -769,9 +768,9 @@ function graphics(callback) {
769
768
  // https://devblogs.microsoft.com/scripting/use-powershell-to-discover-multi-monitor-information/
770
769
  try {
771
770
  const workload = [];
772
- workload.push(util.wmic('path win32_VideoController get /value'));
771
+ workload.push(util.powerShell('Get-WmiObject win32_VideoController | fl *'));
773
772
  workload.push(util.powerShell('gp "HKLM:\\SYSTEM\\ControlSet001\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}\\*" -ErrorAction SilentlyContinue | where MatchingDeviceId $null -NE | select MatchingDeviceId,HardwareInformation.qwMemorySize | fl'));
774
- workload.push(util.wmic('path win32_desktopmonitor get /value'));
773
+ workload.push(util.powerShell('Get-WmiObject win32_desktopmonitor | fl *'));
775
774
  workload.push(util.powerShell('Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorBasicDisplayParams | fl'));
776
775
  workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens'));
777
776
  workload.push(util.powerShell('Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorConnectionParams | fl'));
@@ -783,13 +782,13 @@ function graphics(callback) {
783
782
  workload
784
783
  ).then(data => {
785
784
  // controller + vram
786
- let csections = data[0].split(/\n\s*\n/);
787
- let vsections = data[1].split(/\n\s*\n/);
785
+ let csections = data[0].replace(/\r/g, '').split(/\n\s*\n/);
786
+ let vsections = data[1].replace(/\r/g, '').split(/\n\s*\n/);
788
787
  result.controllers = parseLinesWindowsControllers(csections, vsections);
789
788
  result.controllers = result.controllers.map((controller) => { // match by subDeviceId
790
789
  if (controller.vendor.toLowerCase() === 'nvidia') {
791
790
  return mergeControllerNvidia(controller, nvidiaData.find(device => {
792
- let windowsSubDeviceId = controller.subDeviceId.toLowerCase();
791
+ let windowsSubDeviceId = (controller.subDeviceId || '').toLowerCase();
793
792
  const nvidiaSubDeviceIdParts = device.subDeviceId.split('x');
794
793
  let nvidiaSubDeviceId = nvidiaSubDeviceIdParts.length > 1 ? nvidiaSubDeviceIdParts[1].toLowerCase() : nvidiaSubDeviceIdParts[0].toLowerCase();
795
794
  const lengthDifference = Math.abs(windowsSubDeviceId.length - nvidiaSubDeviceId.length);
@@ -810,25 +809,25 @@ function graphics(callback) {
810
809
  });
811
810
 
812
811
  // displays
813
- let dsections = data[2].split(/\n\s*\n/);
812
+ let dsections = data[2].replace(/\r/g, '').split(/\n\s*\n/);
814
813
  // result.displays = parseLinesWindowsDisplays(dsections);
815
- dsections.shift();
816
- dsections.pop();
814
+ if (dsections[0].trim() === '') { dsections.shift(); }
815
+ if (dsections.length && dsections[dsections.length - 1].trim() === '') { dsections.pop(); }
817
816
 
818
817
  // monitor (powershell)
819
- let msections = data[3].split('Active ');
818
+ let msections = data[3].replace(/\r/g, '').split('Active ');
820
819
  msections.shift();
821
820
 
822
821
  // forms.screens (powershell)
823
- let ssections = data[4].split('BitsPerPixel ');
822
+ let ssections = data[4].replace(/\r/g, '').split('BitsPerPixel ');
824
823
  ssections.shift();
825
824
 
826
825
  // connection params (powershell) - video type
827
- let tsections = data[5].split(/\n\s*\n/);
826
+ let tsections = data[5].replace(/\r/g, '').split(/\n\s*\n/);
828
827
  tsections.shift();
829
828
 
830
829
  // monitor ID (powershell) - model / vendor
831
- const res = data[6].split(/\r\n/);
830
+ const res = data[6].replace(/\r/g, '').split(/\n/);
832
831
  let isections = [];
833
832
  res.forEach(element => {
834
833
  const parts = element.split('|');
@@ -842,6 +841,7 @@ function graphics(callback) {
842
841
  });
843
842
  }
844
843
  });
844
+
845
845
  result.displays = parseLinesWindowsDisplaysPowershell(ssections, msections, dsections, tsections, isections);
846
846
 
847
847
  if (result.displays.length === 1) {
@@ -889,7 +889,7 @@ function graphics(callback) {
889
889
  for (const i in vections) {
890
890
  if ({}.hasOwnProperty.call(vections, i)) {
891
891
  if (vections[i].trim() !== '') {
892
- const lines = vections[i].trim().split(os.EOL);
892
+ const lines = vections[i].trim().split('\n');
893
893
  const matchingDeviceId = util.getValue(lines, 'MatchingDeviceId').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i);
894
894
  if (matchingDeviceId) {
895
895
  const quadWordmemorySize = parseInt(util.getValue(lines, 'HardwareInformation.qwMemorySize'));
@@ -912,12 +912,12 @@ function graphics(callback) {
912
912
  for (let i in sections) {
913
913
  if ({}.hasOwnProperty.call(sections, i)) {
914
914
  if (sections[i].trim() !== '') {
915
- let lines = sections[i].trim().split('\r\n');
916
- let pnpDeviceId = util.getValue(lines, 'PNPDeviceID', '=').match(/PCI\\(VEN_[0-9A-F]{4})&amp;(DEV_[0-9A-F]{4})(?:&amp;(SUBSYS_[0-9A-F]{8}))?(?:&amp;(REV_[0-9A-F]{2}))?/i);
915
+ let lines = sections[i].trim().split('\n');
916
+ let pnpDeviceId = util.getValue(lines, 'PNPDeviceID', ':').match(/PCI\\(VEN_[0-9A-F]{4})&(DEV_[0-9A-F]{4})(?:&(SUBSYS_[0-9A-F]{8}))?(?:&(REV_[0-9A-F]{2}))?/i);
917
917
  let subDeviceId = null;
918
918
  let memorySize = null;
919
919
  if (pnpDeviceId) {
920
- subDeviceId = pnpDeviceId[3];
920
+ subDeviceId = pnpDeviceId[3] || '';
921
921
  if (subDeviceId) {
922
922
  subDeviceId = subDeviceId.split('_')[1];
923
923
  }
@@ -959,17 +959,17 @@ function graphics(callback) {
959
959
  }
960
960
 
961
961
  controllers.push({
962
- vendor: util.getValue(lines, 'AdapterCompatibility', '='),
963
- model: util.getValue(lines, 'name', '='),
964
- bus: util.getValue(lines, 'PNPDeviceID', '=').startsWith('PCI') ? 'PCI' : '',
965
- vram: (memorySize == null ? util.toInt(util.getValue(lines, 'AdapterRAM', '=')) : memorySize) / 1024 / 1024,
966
- vramDynamic: (util.getValue(lines, 'VideoMemoryType', '=') === '2'),
962
+ vendor: util.getValue(lines, 'AdapterCompatibility', ':'),
963
+ model: util.getValue(lines, 'name', ':'),
964
+ bus: util.getValue(lines, 'PNPDeviceID', ':').startsWith('PCI') ? 'PCI' : '',
965
+ vram: (memorySize == null ? util.toInt(util.getValue(lines, 'AdapterRAM', ':')) : memorySize) / 1024 / 1024,
966
+ vramDynamic: (util.getValue(lines, 'VideoMemoryType', ':') === '2'),
967
967
  subDeviceId
968
968
  });
969
- _resolutionX = util.toInt(util.getValue(lines, 'CurrentHorizontalResolution', '=')) || _resolutionX;
970
- _resolutionY = util.toInt(util.getValue(lines, 'CurrentVerticalResolution', '=')) || _resolutionY;
971
- _refreshRate = util.toInt(util.getValue(lines, 'CurrentRefreshRate', '=')) || _refreshRate;
972
- _pixelDepth = util.toInt(util.getValue(lines, 'CurrentBitsPerPixel', '=')) || _pixelDepth;
969
+ _resolutionX = util.toInt(util.getValue(lines, 'CurrentHorizontalResolution', ':')) || _resolutionX;
970
+ _resolutionY = util.toInt(util.getValue(lines, 'CurrentVerticalResolution', ':')) || _resolutionY;
971
+ _refreshRate = util.toInt(util.getValue(lines, 'CurrentRefreshRate', ':')) || _refreshRate;
972
+ _pixelDepth = util.toInt(util.getValue(lines, 'CurrentBitsPerPixel', ':')) || _pixelDepth;
973
973
  }
974
974
  }
975
975
  }
@@ -984,12 +984,12 @@ function graphics(callback) {
984
984
  let resolutionX = 0;
985
985
  let resolutionY = 0;
986
986
  if (dsections && dsections.length) {
987
- let linesDisplay = dsections[0].split(os.EOL);
988
- vendor = util.getValue(linesDisplay, 'MonitorManufacturer', '=');
989
- model = util.getValue(linesDisplay, 'Name', '=');
990
- deviceID = util.getValue(linesDisplay, 'PNPDeviceID', '=').replace(/&amp;/g, '&').toLowerCase();
991
- resolutionX = util.toInt(util.getValue(linesDisplay, 'ScreenWidth', '='));
992
- resolutionY = util.toInt(util.getValue(linesDisplay, 'ScreenHeight', '='));
987
+ let linesDisplay = dsections[0].split('\n');
988
+ vendor = util.getValue(linesDisplay, 'MonitorManufacturer', ':');
989
+ model = util.getValue(linesDisplay, 'Name', ':');
990
+ deviceID = util.getValue(linesDisplay, 'PNPDeviceID', ':').replace(/&amp;/g, '&').toLowerCase();
991
+ resolutionX = util.toInt(util.getValue(linesDisplay, 'ScreenWidth', ':'));
992
+ resolutionY = util.toInt(util.getValue(linesDisplay, 'ScreenHeight', ':'));
993
993
  }
994
994
  for (let i = 0; i < ssections.length; i++) {
995
995
  if (ssections[i].trim() !== '') {
@@ -1000,12 +1000,12 @@ function graphics(callback) {
1000
1000
  if (tsections.length === 0 || tsections[i] === undefined) {
1001
1001
  tsections[i] = 'Unknown';
1002
1002
  }
1003
- let linesScreen = ssections[i].split(os.EOL);
1004
- let linesMonitor = msections[i].split(os.EOL);
1003
+ let linesScreen = ssections[i].split('\n');
1004
+ let linesMonitor = msections[i].split('\n');
1005
1005
 
1006
- let linesConnection = tsections[i].split(os.EOL);
1006
+ let linesConnection = tsections[i].split('\n');
1007
1007
  const bitsPerPixel = util.getValue(linesScreen, 'BitsPerPixel');
1008
- const bounds = util.getValue(linesScreen, 'Bounds').replace('{', '').replace('}', '').split(',');
1008
+ const bounds = util.getValue(linesScreen, 'Bounds').replace('{', '').replace('}', '').replace(/=/g, ':').split(',');
1009
1009
  const primary = util.getValue(linesScreen, 'Primary');
1010
1010
  const sizeX = util.getValue(linesMonitor, 'MaxHorizontalImageSize');
1011
1011
  const sizeY = util.getValue(linesMonitor, 'MaxVerticalImageSize');
@@ -1027,15 +1027,15 @@ function graphics(callback) {
1027
1027
  main: primary.toLowerCase() === 'true',
1028
1028
  builtin: videoOutputTechnology === '2147483648',
1029
1029
  connection: videoOutputTechnology && videoTypes[videoOutputTechnology] ? videoTypes[videoOutputTechnology] : '',
1030
- resolutionX: util.toInt(util.getValue(bounds, 'Width', '=')),
1031
- resolutionY: util.toInt(util.getValue(bounds, 'Height', '=')),
1030
+ resolutionX: util.toInt(util.getValue(bounds, 'Width', ':')),
1031
+ resolutionY: util.toInt(util.getValue(bounds, 'Height', ':')),
1032
1032
  sizeX: sizeX ? parseInt(sizeX, 10) : null,
1033
1033
  sizeY: sizeY ? parseInt(sizeY, 10) : null,
1034
1034
  pixelDepth: bitsPerPixel,
1035
- currentResX: util.toInt(util.getValue(bounds, 'Width', '=')),
1036
- currentResY: util.toInt(util.getValue(bounds, 'Height', '=')),
1037
- positionX: util.toInt(util.getValue(bounds, 'X', '=')),
1038
- positionY: util.toInt(util.getValue(bounds, 'Y', '=')),
1035
+ currentResX: util.toInt(util.getValue(bounds, 'Width', ':')),
1036
+ currentResY: util.toInt(util.getValue(bounds, 'Height', ':')),
1037
+ positionX: util.toInt(util.getValue(bounds, 'X', ':')),
1038
+ positionY: util.toInt(util.getValue(bounds, 'Y', ':')),
1039
1039
  });
1040
1040
  }
1041
1041
  }
@@ -1057,7 +1057,6 @@ function graphics(callback) {
1057
1057
  }
1058
1058
  return displays;
1059
1059
  }
1060
-
1061
1060
  }
1062
1061
 
1063
1062
  exports.graphics = graphics;
package/lib/index.d.ts CHANGED
@@ -48,6 +48,8 @@ export namespace Systeminformation {
48
48
  version: string;
49
49
  serial: string;
50
50
  assetTag: string;
51
+ memMax: number | null;
52
+ memSlots: number | null;
51
53
  }
52
54
 
53
55
  interface ChassisData {
@@ -127,14 +129,15 @@ export namespace Systeminformation {
127
129
  size: number;
128
130
  bank: string;
129
131
  type: string;
130
- ecc?: boolean;
131
- clockSpeed: number;
132
+ ecc?: boolean | null;
133
+ clockSpeed: number | null;
132
134
  formFactor: string;
135
+ manufacturer?: string;
133
136
  partNum: string;
134
137
  serialNum: string;
135
- voltageConfigured: number;
136
- voltageMin: number;
137
- voltageMax: number;
138
+ voltageConfigured: number | null;
139
+ voltageMin: number | null;
140
+ voltageMax: number | null;
138
141
  }
139
142
 
140
143
  interface SmartData {
@@ -360,11 +363,13 @@ export namespace Systeminformation {
360
363
  uefi: boolean;
361
364
  hypervizor?: boolean;
362
365
  remoteSession?: boolean;
366
+ hypervisor?: boolean;
363
367
  }
364
368
 
365
369
  interface UuidData {
366
370
  os: string;
367
371
  hardware: string;
372
+ macs: string[];
368
373
  }
369
374
 
370
375
  interface VersionData {
@@ -537,6 +542,7 @@ export namespace Systeminformation {
537
542
  iface: string;
538
543
  model: string;
539
544
  vendor: string;
545
+ mac: string;
540
546
  }
541
547
 
542
548
  interface WifiConnectionData {
@@ -655,7 +661,7 @@ export namespace Systeminformation {
655
661
  bridgeNfIptables: boolean;
656
662
  bridgeNfIp6tables: boolean;
657
663
  debug: boolean;
658
- mfd: number;
664
+ nfd: number;
659
665
  oomKillDisable: boolean;
660
666
  ngoroutines: number;
661
667
  systemTime: string;
@@ -741,6 +747,7 @@ export namespace Systeminformation {
741
747
  memLimit: number;
742
748
  memPercent: number;
743
749
  cpuPercent: number;
750
+ pids: number;
744
751
  netIO: {
745
752
  rx: number;
746
753
  wx: number;
@@ -756,6 +763,23 @@ export namespace Systeminformation {
756
763
  networks: any;
757
764
  }
758
765
 
766
+ interface DockerContainerProcessData {
767
+ pidHost: string;
768
+ ppid: string;
769
+ pgid: string;
770
+ user: string;
771
+ ruser: string;
772
+ group: string;
773
+ rgroup: string;
774
+ stat: string;
775
+ time: string;
776
+ elapsed: string;
777
+ nice: string;
778
+ rss: string;
779
+ vsz: string;
780
+ command: string;
781
+ }
782
+
759
783
  interface DockerVolumeData {
760
784
  name: string;
761
785
  driver: string;
@@ -931,7 +955,7 @@ export function dockerInfo(cb?: (data: Systeminformation.DockerInfoData) => any)
931
955
  export function dockerImages(all?: boolean, cb?: (data: Systeminformation.DockerImageData[]) => any): Promise<Systeminformation.DockerImageData[]>;
932
956
  export function dockerContainers(all?: boolean, cb?: (data: Systeminformation.DockerContainerData[]) => any): Promise<Systeminformation.DockerContainerData[]>;
933
957
  export function dockerContainerStats(id?: string, cb?: (data: Systeminformation.DockerContainerStatsData[]) => any): Promise<Systeminformation.DockerContainerStatsData[]>;
934
- export function dockerContainerProcesses(id?: string, cb?: (data: any) => any): Promise<any>;
958
+ export function dockerContainerProcesses(id?: string, cb?: (data: any) => any): Promise<Systeminformation.DockerContainerProcessData[]>;
935
959
  export function dockerVolumes(cb?: (data: Systeminformation.DockerVolumeData[]) => any): Promise<Systeminformation.DockerVolumeData[]>;
936
960
  export function dockerAll(cb?: (data: any) => any): Promise<any>;
937
961
 
package/lib/memory.js CHANGED
@@ -256,14 +256,14 @@ function mem(callback) {
256
256
  let swaptotal = 0;
257
257
  let swapused = 0;
258
258
  try {
259
- util.wmic('pagefile get AllocatedBaseSize, CurrentUsage').then((stdout, error) => {
259
+ util.powerShell('Get-CimInstance Win32_PageFileUsage | Select AllocatedBaseSize, CurrentUsage').then((stdout, error) => {
260
260
  if (!error) {
261
261
  let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0);
262
262
  lines.forEach(function (line) {
263
263
  if (line !== '') {
264
264
  line = line.trim().split(/\s\s+/);
265
- swaptotal = swaptotal + parseInt(line[0], 10);
266
- swapused = swapused + parseInt(line[1], 10);
265
+ swaptotal = swaptotal + (parseInt(line[0], 10) || 0);
266
+ swapused = swapused + (parseInt(line[1], 10) || 0);
267
267
  }
268
268
  });
269
269
  }
@@ -329,9 +329,9 @@ function memLayout(callback) {
329
329
  manufacturer: getManufacturerLinux(util.getValue(lines, 'Manufacturer:')),
330
330
  partNum: util.getValue(lines, 'Part Number:'),
331
331
  serialNum: util.getValue(lines, 'Serial Number:'),
332
- voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:') || null),
333
- voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:') || null),
334
- voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:') || null),
332
+ voltageConfigured: parseFloat(util.getValue(lines, 'Configured Voltage:')) || null,
333
+ voltageMin: parseFloat(util.getValue(lines, 'Minimum Voltage:')) || null,
334
+ voltageMax: parseFloat(util.getValue(lines, 'Maximum Voltage:'))|| null,
335
335
  });
336
336
  } else {
337
337
  result.push({
@@ -384,14 +384,14 @@ function memLayout(callback) {
384
384
  result[0].type = version && version[2] && version[2] === '3' ? 'LPDDR4' : result[0].type;
385
385
  result[0].ecc = false;
386
386
  result[0].clockSpeed = version && version[2] && clockSpeed[version[2]] || 400;
387
- result[0].clockSpeed = version && version[4] && version[4] === 'd' ? '500' : result[0].clockSpeed;
387
+ result[0].clockSpeed = version && version[4] && version[4] === 'd' ? 500 : result[0].clockSpeed;
388
388
  result[0].formFactor = 'SoC';
389
389
 
390
390
  stdout = execSync('vcgencmd get_config sdram_freq 2>/dev/null');
391
391
  lines = stdout.toString().split('\n');
392
392
  let freq = parseInt(util.getValue(lines, 'sdram_freq', '=', true), 10) || 0;
393
393
  if (freq) {
394
- result.clockSpeed = freq;
394
+ result[0].clockSpeed = freq;
395
395
  }
396
396
 
397
397
  stdout = execSync('vcgencmd measure_volts sdram_p 2>/dev/null');
@@ -469,7 +469,7 @@ function memLayout(callback) {
469
469
  if (size && type) {
470
470
  result.push({
471
471
  size: size * 1024 * 1024 * 1024,
472
- bank: 0,
472
+ bank: '0',
473
473
  type,
474
474
  ecc: false,
475
475
  clockSpeed: 0,
@@ -497,28 +497,31 @@ function memLayout(callback) {
497
497
  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('|');
498
498
 
499
499
  try {
500
- util.wmic('memorychip get /value').then((stdout, error) => {
500
+ util.powerShell('Get-WmiObject Win32_PhysicalMemory | fl *').then((stdout, error) => {
501
501
  if (!error) {
502
- let devices = stdout.toString().split('BankL');
502
+ let devices = stdout.toString().split(/\n\s*\n/);
503
503
  devices.shift();
504
504
  devices.forEach(function (device) {
505
505
  let lines = device.split('\r\n');
506
- const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', '='));
507
- const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', '='));
508
- result.push({
509
- size: parseInt(util.getValue(lines, 'Capacity', '='), 10) || 0,
510
- bank: util.getValue(lines, 'abel', '='), // BankLabel
511
- type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', '='), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', '='), 10)],
512
- ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
513
- clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', '='), 10) || parseInt(util.getValue(lines, 'Speed', '='), 10) || 0,
514
- formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', '='), 10) || 0],
515
- manufacturer: util.getValue(lines, 'Manufacturer', '='),
516
- partNum: util.getValue(lines, 'PartNumber', '='),
517
- serialNum: util.getValue(lines, 'SerialNumber', '='),
518
- voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', '='), 10) || 0) / 1000.0,
519
- voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', '='), 10) || 0) / 1000.0,
520
- voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', '='), 10) || 0) / 1000.0,
521
- });
506
+ const dataWidth = util.toInt(util.getValue(lines, 'DataWidth', ':'));
507
+ const totalWidth = util.toInt(util.getValue(lines, 'TotalWidth', ':'));
508
+ const size = parseInt(util.getValue(lines, 'Capacity', ':'), 10) || 0;
509
+ if (size) {
510
+ result.push({
511
+ size,
512
+ bank: util.getValue(lines, 'BankLabel', ':'), // BankLabel
513
+ type: memoryTypes[parseInt(util.getValue(lines, 'MemoryType', ':'), 10) || parseInt(util.getValue(lines, 'SMBIOSMemoryType', ':'), 10)],
514
+ ecc: dataWidth && totalWidth ? totalWidth > dataWidth : false,
515
+ clockSpeed: parseInt(util.getValue(lines, 'ConfiguredClockSpeed', ':'), 10) || parseInt(util.getValue(lines, 'Speed', ':'), 10) || 0,
516
+ formFactor: FormFactors[parseInt(util.getValue(lines, 'FormFactor', ':'), 10) || 0],
517
+ manufacturer: util.getValue(lines, 'Manufacturer', ':'),
518
+ partNum: util.getValue(lines, 'PartNumber', ':'),
519
+ serialNum: util.getValue(lines, 'SerialNumber', ':'),
520
+ voltageConfigured: (parseInt(util.getValue(lines, 'ConfiguredVoltage', ':'), 10) || 0) / 1000.0,
521
+ voltageMin: (parseInt(util.getValue(lines, 'MinVoltage', ':'), 10) || 0) / 1000.0,
522
+ voltageMax: (parseInt(util.getValue(lines, 'MaxVoltage', ':'), 10) || 0) / 1000.0,
523
+ });
524
+ }
522
525
  });
523
526
  }
524
527
  if (callback) { callback(result); }