systeminformation 5.9.9 → 5.9.13

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/lib/users.js CHANGED
@@ -283,43 +283,50 @@ function users(callback) {
283
283
  }
284
284
  if (_windows) {
285
285
  try {
286
- const workload = [];
287
- // workload.push(util.powerShell('Get-CimInstance -ClassName Win32_Account | fl *'));
288
- workload.push(util.powerShell('Get-WmiObject Win32_LogonSession | fl *'));
289
- workload.push(util.powerShell('Get-WmiObject Win32_LoggedOnUser | fl *'));
290
- workload.push(util.powerShell('Get-WmiObject Win32_Process -Filter "name=\'explorer.exe\'" | Select @{Name="domain";Expression={$_.GetOwner().Domain}}, @{Name="username";Expression={$_.GetOwner().User}} | fl'));
291
- Promise.all(
292
- workload
293
- ).then(data => {
286
+ // const workload = [];
287
+ // // workload.push(util.powerShell('Get-CimInstance -ClassName Win32_Account | fl *'));
288
+ // workload.push(util.powerShell('Get-WmiObject Win32_LogonSession | fl *'));
289
+ // workload.push(util.powerShell('Get-WmiObject Win32_LoggedOnUser | fl *'));
290
+ // workload.push(util.powerShell('Get-WmiObject Win32_Process -Filter "name=\'explorer.exe\'" | Select @{Name="domain";Expression={$_.GetOwner().Domain}}, @{Name="username";Expression={$_.GetOwner().User}} | fl'));
291
+ // Promise.all(
292
+ // workload
293
+ // ).then(data => {
294
+ let cmd = 'Get-WmiObject Win32_LogonSession | fl *' + '; echo \'#-#-#-#\';';
295
+ cmd += 'Get-WmiObject Win32_LoggedOnUser | fl *' + '; echo \'#-#-#-#\';';
296
+ cmd += 'Get-WmiObject Win32_Process -Filter "name=\'explorer.exe\'" | Select @{Name="domain";Expression={$_.GetOwner().Domain}}, @{Name="username";Expression={$_.GetOwner().User}} | fl';
297
+ util.powerShell(cmd).then(data => {
294
298
  // controller + vram
295
299
  // let accounts = parseWinAccounts(data[0].split(/\n\s*\n/));
296
- let sessions = parseWinSessions(data[0].split(/\n\s*\n/));
297
- let loggedons = parseWinLoggedOn(data[1].split(/\n\s*\n/));
298
- let users = parseWinUsers(data[2].split(/\n\s*\n/));
299
- for (let id in loggedons) {
300
- if ({}.hasOwnProperty.call(loggedons, id)) {
301
- loggedons[id].dateTime = {}.hasOwnProperty.call(sessions, id) ? sessions[id] : '';
302
- }
303
- }
304
- users.forEach(user => {
305
- let dateTime = '';
300
+ if (data) {
301
+ data = data.split('#-#-#-#');
302
+ let sessions = parseWinSessions(data[0].split(/\n\s*\n/));
303
+ let loggedons = parseWinLoggedOn(data[1].split(/\n\s*\n/));
304
+ let users = parseWinUsers(data[2].split(/\n\s*\n/));
306
305
  for (let id in loggedons) {
307
306
  if ({}.hasOwnProperty.call(loggedons, id)) {
308
- if (loggedons[id].user === user.user && (!dateTime || dateTime < loggedons[id].dateTime)) {
309
- dateTime = loggedons[id].dateTime;
310
- }
307
+ loggedons[id].dateTime = {}.hasOwnProperty.call(sessions, id) ? sessions[id] : '';
311
308
  }
312
309
  }
310
+ users.forEach(user => {
311
+ let dateTime = '';
312
+ for (let id in loggedons) {
313
+ if ({}.hasOwnProperty.call(loggedons, id)) {
314
+ if (loggedons[id].user === user.user && (!dateTime || dateTime < loggedons[id].dateTime)) {
315
+ dateTime = loggedons[id].dateTime;
316
+ }
317
+ }
318
+ }
313
319
 
314
- result.push({
315
- user: user.user,
316
- tty: '',
317
- date: `${dateTime.substr(0, 4)}-${dateTime.substr(4, 2)}-${dateTime.substr(6, 2)}`,
318
- time: `${dateTime.substr(8, 2)}:${dateTime.substr(10, 2)}`,
319
- ip: '',
320
- command: ''
320
+ result.push({
321
+ user: user.user,
322
+ tty: '',
323
+ date: `${dateTime.substr(0, 4)}-${dateTime.substr(4, 2)}-${dateTime.substr(6, 2)}`,
324
+ time: `${dateTime.substr(8, 2)}:${dateTime.substr(10, 2)}`,
325
+ ip: '',
326
+ command: ''
327
+ });
321
328
  });
322
- });
329
+ }
323
330
  if (callback) { callback(result); }
324
331
  resolve(result);
325
332
 
package/lib/util.js CHANGED
@@ -360,7 +360,7 @@ function powerShell(cmd) {
360
360
  return new Promise((resolve) => {
361
361
  process.nextTick(() => {
362
362
  try {
363
- const child = spawn('powershell.exe', ['-NoLogo', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], {
363
+ const child = spawn('powershell.exe', ['-NoLogo', '-NoProfile', '-InputFormat', 'Text', '-NoExit', '-ExecutionPolicy', 'Unrestricted', '-Command', '-'], { // added NoProfile
364
364
  stdio: 'pipe',
365
365
  windowsHide: true,
366
366
  maxBuffer: 1024 * 20000,
@@ -875,6 +875,7 @@ function decodePiCpuinfo(lines) {
875
875
  '0f': 'Internal use only',
876
876
  '10': 'CM3+',
877
877
  '11': '4B',
878
+ '12': 'Zero 2 W',
878
879
  '13': '400',
879
880
  '14': 'CM4'
880
881
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.9.9",
3
+ "version": "5.9.13",
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)",
@@ -93,6 +93,6 @@
93
93
  "sunos"
94
94
  ],
95
95
  "engines": {
96
- "node": ">=4.0.0"
96
+ "node": ">=8.0.0"
97
97
  }
98
98
  }