diff --git a/lib/osinfo.js b/lib/osinfo.js index e1e007c..92d27cc 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -1132,13 +1132,13 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`; if (process.arch === 'ia32' && Object.prototype.hasOwnProperty.call(process.env, 'PROCESSOR_ARCHITEW6432')) { sysdir = '%windir%\\sysnative\\cmd.exe /c %windir%\\System32'; } - exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) { - parts = stdout.toString().split('\n\r')[0].split('REG_SZ'); - result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/ig, '').toLowerCase() : ''; - util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | 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'); - result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase(); + util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | 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'); + result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase(); + exec(`${sysdir}\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid`, util.execOptsWin, function (error, stdout) { + parts = stdout.toString().split('\n\r')[0].split('REG_SZ'); + result.os = parts.length > 1 ? parts[1].replace(/\r+|\n+|\s+/ig, '').toLowerCase() : ''; if (callback) { callback(result); }