const shell = require('node-powershell');
let ps = new shell({
executionPolicy: 'Bypass',
noProfile: true
});
//To get number of screen attached uncomment the below line
ps.addCommand('(Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorBasicDisplayParams | where {$_.Active -like "True"}).Active.Count')
//To get attached USB drive with computer
// ps.addCommand('wmic logicaldisk where drivetype=2 get caption')
ps.invoke()
.then(output => {
console.log('output '+output);
})
.catch(err => {
console.log(err);
ps.dispose();
}); gui.Screen.on('displayBoundsChanged', function () { console.log('changed'); });