Я выяснил, как мы можем определить номер экрана и любое устройство, подключенное с USB.Приведенный ниже код может помочь кому-то, кто хочет проверить дубликаты экрана или USB-накопителя, подключенного к компьютеру с Windows:
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();
});