1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
const shell = require('node-powershell'); const express = require('express') const app = express() let ps = new shell({ executionPolicy: 'Bypass', noProfile: true }); ps.addCommand('$ComputerSystem=Get-WmiObject Win32_ComputerSystem;$BaseBoard=Get-WmiObject Win32_BaseBoard;$BIOS=Get-WmiObject Win32_BIOS;$Processor=Get-WmiObject Win32_Processor;[PSCustomObject]@{ Model = $ComputerSystem.Model; ManufacturerBoard = $BaseBoard.Manufacturer; BIOSVersion = $BIOS.SMbiosbiosversion; BIOSSerialNumber = $BIOS.serialnumber; ManufacturerProcessor=$Processor.Manufacturer; MaxClockSpeed=$Processor.MaxClockSpeed} | ConvertTo-Html') ps.invoke() .then(output => { console.log(output); app.get('/', function (req, res) { res.send(output); }) }) .catch(err => { console.log(err); ps.dispose(); }); app.listen(3000, function () { console.log('Example app listening on port 3000!') }) |