Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion lib/osinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,18 @@ echo -n "hardware: "; cat /sys/class/dmi/id/product_uuid 2> /dev/null; echo;`;
}
util.powerShell('Get-CimInstance Win32_ComputerSystemProduct | select UUID | fl').then((stdout) => {
let lines = stdout.split('\r\n');
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase();
let output = ''
const windir = process.env.windir || 'C:\\Windows';
const wmicPath = `${windir}\\System32\\wbem\\wmic.exe`;
if (fs.existsSync(wmicPath)) {
output = execSync(
`"${wmicPath}" csproduct get uuid`,
{ encoding: 'utf-8' }
).split('\n')[1]
.trim()
.toLowerCase();
}
result.hardware = util.getValue(lines, 'uuid', ':').toLowerCase() || output;
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() : '';
Expand Down