diff --git a/lib/audio.js b/lib/audio.js index 68e711b..babebad 100644 --- a/lib/audio.js +++ b/lib/audio.js @@ -194,7 +194,7 @@ function audio(callback) { }); } if (_windows) { - util.powerShell('Get-WmiObject Win32_SoundDevice | fl *').then((stdout, error) => { + util.powerShell('Get-WmiObject Win32_SoundDevice | select DeviceID,StatusInfo,Name,Manufacturer | fl').then((stdout, error) => { if (!error) { const parts = stdout.toString().split(/\n\s*\n/); for (let i = 0; i < parts.length; i++) { diff --git a/lib/battery.js b/lib/battery.js index 82558f9..511e813 100644 --- a/lib/battery.js +++ b/lib/battery.js @@ -225,7 +225,7 @@ module.exports = function (callback) { if (_windows) { try { const workload = []; - workload.push(util.powerShell('Get-WmiObject Win32_Battery | fl *')); + workload.push(util.powerShell('Get-WmiObject Win32_Battery | select BatteryStatus, DesignCapacity, DesignVoltage, EstimatedChargeRemaining, DeviceID | fl')); workload.push(util.powerShell('(Get-WmiObject -Class BatteryStaticData -Namespace ROOT/WMI).DesignedCapacity')); workload.push(util.powerShell('(Get-WmiObject -Class BatteryFullChargedCapacity -Namespace ROOT/WMI).FullChargedCapacity')); util.promiseAll( diff --git a/lib/bluetooth.js b/lib/bluetooth.js index b75cdac..76bbe96 100644 --- a/lib/bluetooth.js +++ b/lib/bluetooth.js @@ -158,7 +158,7 @@ function bluetoothDevices(callback) { }); } if (_windows) { - util.powerShell('Get-WmiObject Win32_PNPEntity | fl *').then((stdout, error) => { + util.powerShell('Get-WmiObject Win32_PNPEntity | select PNPClass, Name, Manufacturer | fl').then((stdout, error) => { if (!error) { const parts = stdout.toString().split(/\n\s*\n/); for (let i = 0; i < parts.length; i++) { diff --git a/lib/cpu.js b/lib/cpu.js index 4b4c17c..a513df0 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -797,8 +797,8 @@ function getCpu() { if (_windows) { try { const workload = []; - workload.push(util.powerShell('Get-WmiObject Win32_processor | fl *')); - workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl *')); + workload.push(util.powerShell('Get-WmiObject Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl')); + workload.push(util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl')); // workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"')); workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent')); @@ -1425,7 +1425,7 @@ function cpuCache(callback) { } if (_windows) { try { - util.powerShell('Get-WmiObject Win32_processor | fl *').then((stdout, error) => { + util.powerShell('Get-WmiObject Win32_processor | select L2CacheSize, L3CacheSize | fl').then((stdout, error) => { if (!error) { let lines = stdout.split('\r\n'); result.l1d = 0; @@ -1435,7 +1435,7 @@ function cpuCache(callback) { if (result.l2) { result.l2 = parseInt(result.l2, 10) * 1024; } if (result.l3) { result.l3 = parseInt(result.l3, 10) * 1024; } } - util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl ').then((stdout, error) => { + util.powerShell('Get-WmiObject Win32_CacheMemory | select CacheType,InstalledSize,Level | fl').then((stdout, error) => { if (!error) { const parts = stdout.split(/\n\s*\n/); parts.forEach(function (part) { diff --git a/lib/filesystem.js b/lib/filesystem.js index 8b8e4ac..80c2a48 100644 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -127,7 +127,7 @@ function fsSize(callback) { if (_windows) { try { // util.wmic('logicaldisk get Caption,FileSystem,FreeSpace,Size').then((stdout) => { - util.powerShell('Get-WmiObject Win32_logicaldisk | fl *').then((stdout, error) => { + util.powerShell('Get-WmiObject Win32_logicaldisk | select Caption,FileSystem,FreeSpace,Size | fl').then((stdout, error) => { if (!error) { let devices = stdout.toString().split(/\n\s*\n/); devices.forEach(function (device) { @@ -400,7 +400,8 @@ function blockDevices(callback) { let drivetypes = ['Unknown', 'NoRoot', 'Removable', 'Local', 'Network', 'CD/DVD', 'RAM']; try { // util.wmic('logicaldisk get Caption,Description,DeviceID,DriveType,FileSystem,FreeSpace,Name,Size,VolumeName,VolumeSerialNumber /value').then((stdout, error) => { - util.powerShell('Get-CimInstance -ClassName Win32_LogicalDisk | Format-List *').then((stdout, error) => { + // util.powerShell('Get-WmiObject Win32_logicaldisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl').then((stdout, error) => { + util.powerShell('Get-CimInstance -ClassName Win32_LogicalDisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl').then((stdout, error) => { if (!error) { let devices = stdout.toString().split(/\n\s*\n/); devices.forEach(function (device) { @@ -1167,8 +1168,8 @@ function diskLayout(callback) { if (_windows) { try { const workload = []; - workload.push(util.powerShell('Get-WmiObject Win32_DiskDrive | fl *')); - workload.push(util.powerShell('Get-PhysicalDisk | Format-List')); + workload.push(util.powerShell('Get-WmiObject Win32_DiskDrive | select Caption,Size,Status,PNPDeviceId,BytesPerSector,TotalCylinder,TotalHeads,TotalSectors,TotalTracks,TracksPerCylinder,SectorsPerTrack,FirmwareRevision,SerialNumber,InterfaceType | fl')); + workload.push(util.powerShell('Get-PhysicalDisk | select BusType,MediaType,FriendlyName,Model,SerialNumber,Size | fl')); if (util.smartMonToolsInstalled()) { try { const smartDev = JSON.parse(execSync('smartctl --scan -j')); diff --git a/lib/memory.js b/lib/memory.js index fd4af73..bbf7e5c 100644 --- a/lib/memory.js +++ b/lib/memory.js @@ -504,7 +504,7 @@ function memLayout(callback) { const FormFactors = 'Unknown|Other|SIP|DIP|ZIP|SOJ|Proprietary|SIMM|DIMM|TSOP|PGA|RIMM|SODIMM|SRIMM|SMD|SSMP|QFP|TQFP|SOIC|LCC|PLCC|BGA|FPBGA|LGA'.split('|'); try { - util.powerShell('Get-WmiObject Win32_PhysicalMemory | fl *').then((stdout, error) => { + util.powerShell('Get-WmiObject Win32_PhysicalMemory | select DataWidth,TotalWidth,Capacity,BankLabel,MemoryType,SMBIOSMemoryType,ConfiguredClockSpeed,FormFactor,Manufacturer,PartNumber,SerialNumber,ConfiguredVoltage,MinVoltage,MaxVoltage | fl').then((stdout, error) => { if (!error) { let devices = stdout.toString().split(/\n\s*\n/); devices.shift(); diff --git a/lib/network.js b/lib/network.js index 31a2ca6..4756691 100644 --- a/lib/network.js +++ b/lib/network.js @@ -1306,7 +1306,7 @@ function networkStatsSingle(iface) { let ifaceName = ifaceSanitized; // Performance Data - util.powerShell('Get-WmiObject Win32_PerfRawData_Tcpip_NetworkInterface | fl *').then((stdout, error) => { + util.powerShell('Get-WmiObject Win32_PerfRawData_Tcpip_NetworkInterface | select Name,BytesReceivedPersec,PacketsReceivedErrors,PacketsReceivedDiscarded,BytesSentPersec,PacketsOutboundErrors,PacketsOutboundDiscarded | fl').then((stdout, error) => { if (!error) { const psections = stdout.toString().split(/\n\s*\n/); perfData = parseLinesWindowsPerfData(psections); diff --git a/lib/osinfo.js b/lib/osinfo.js index 3551635..ff66c3c 100644 --- a/lib/osinfo.js +++ b/lib/osinfo.js @@ -330,7 +330,7 @@ function osInfo(callback) { result.release = result.kernel; try { const workload = []; - workload.push(util.powerShell('Get-WmiObject Win32_OperatingSystem | fl *')); + workload.push(util.powerShell('Get-WmiObject Win32_OperatingSystem | select Caption,SerialNumber,BuildNumber,ServicePackMajorVersion,ServicePackMinorVersion | fl')); // workload.push(execPromise('systeminfo', util.execOptsWin)); // workload.push(util.powerShell('Get-ComputerInfo -property "HyperV*"')); workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent')); diff --git a/lib/printer.js b/lib/printer.js index 265ef50..1a6f319 100644 --- a/lib/printer.js +++ b/lib/printer.js @@ -186,7 +186,7 @@ function printer(callback) { }); } if (_windows) { - util.powerShell('Get-WmiObject Win32_Printer | fl *').then((stdout, error) => { + util.powerShell('Get-WmiObject Win32_Printer | select PrinterStatus,Name,DriverName,Local,Default,Shared | fl').then((stdout, error) => { if (!error) { const parts = stdout.toString().split(/\n\s*\n/); for (let i = 0; i < parts.length; i++) { diff --git a/lib/system.js b/lib/system.js index 66fa47c..7d1c3f8 100644 --- a/lib/system.js +++ b/lib/system.js @@ -343,7 +343,7 @@ function system(callback) { } if (_windows) { try { - util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | fl *').then((stdout, error) => { + util.powerShell('Get-WmiObject Win32_ComputerSystemProduct | select Name,Vendor,Version,IdentifyingNumber,UUID | fl').then((stdout, error) => { if (!error) { // 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'); @@ -369,7 +369,7 @@ function system(callback) { if (manufacturer.startsWith('xen')) { result.virtualHost = 'Xen'; } if (manufacturer.startsWith('qemu')) { result.virtualHost = 'KVM'; } } - util.powerShell('Get-WmiObject MS_Systeminformation -Namespace "root/wmi" | fl *').then((stdout, error) => { + util.powerShell('Get-WmiObject MS_Systeminformation -Namespace "root/wmi" | select systemsku | fl ').then((stdout, error) => { if (!error) { let lines = stdout.split('\r\n'); result.sku = util.getValue(lines, 'systemsku', ':'); @@ -506,7 +506,7 @@ function bios(callback) { } if (_windows) { try { - util.powerShell('Get-WmiObject Win32_bios | fl *').then((stdout, error) => { + util.powerShell('Get-WmiObject Win32_bios | select Description,Version,Manufacturer,ReleaseDate,BuildNumber,SerialNumber | fl').then((stdout, error) => { if (!error) { let lines = stdout.toString().split('\r\n'); const description = util.getValue(lines, 'description', ':'); @@ -662,7 +662,7 @@ function baseboard(callback) { if (_windows) { try { const workload = []; - workload.push(util.powerShell('Get-WmiObject Win32_baseboard | fl *')); + workload.push(util.powerShell('Get-WmiObject Win32_baseboard | select Model,Manufacturer,Product,Version,SerialNumber,PartNumber,SKU | fl')); workload.push(util.powerShell('Get-WmiObject Win32_physicalmemoryarray | select MaxCapacity, MemoryDevices | fl')); util.promiseAll( workload @@ -795,7 +795,7 @@ function chassis(callback) { } if (_windows) { try { - util.powerShell('Get-WmiObject Win32_SystemEnclosure | fl *').then((stdout, error) => { + util.powerShell('Get-WmiObject Win32_SystemEnclosure | select Model,Manufacturer,ChassisTypes,Version,SerialNumber,PartNumber,SKU | fl').then((stdout, error) => { if (!error) { let lines = stdout.toString().split('\r\n'); diff --git a/lib/usb.js b/lib/usb.js index 2170490..ef96f41 100644 --- a/lib/usb.js +++ b/lib/usb.js @@ -263,7 +263,7 @@ function usb(callback) { }); } if (_windows) { - util.powerShell('Get-WmiObject CIM_LogicalDevice | where { $_.Description -match "USB"}').then((stdout, error) => { + util.powerShell('Get-WmiObject CIM_LogicalDevice | where { $_.Description -match "USB"} | select Name,CreationClassName,DeviceId,Manufacturer | fl').then((stdout, error) => { if (!error) { const parts = stdout.toString().split(/\n\s*\n/); for (let i = 0; i < parts.length; i++) { diff --git a/lib/users.js b/lib/users.js index 07a8424..0ea040a 100644 --- a/lib/users.js +++ b/lib/users.js @@ -253,8 +253,8 @@ function users(callback) { // Promise.all( // workload // ).then(data => { - let cmd = 'Get-WmiObject Win32_LogonSession | fl *' + '; echo \'#-#-#-#\';'; - cmd += 'Get-WmiObject Win32_LoggedOnUser | fl *' + '; echo \'#-#-#-#\';'; + let cmd = 'Get-WmiObject Win32_LogonSession | select LogonId,StartTime | fl' + '; echo \'#-#-#-#\';'; + cmd += 'Get-WmiObject Win32_LoggedOnUser | select antecedent,dependent | fl ' + '; echo \'#-#-#-#\';'; cmd += 'Get-WmiObject Win32_Process -Filter "name=\'explorer.exe\'" | Select @{Name="sessionid";Expression={$_.SessionId}}, @{Name="domain";Expression={$_.GetOwner().Domain}}, @{Name="username";Expression={$_.GetOwner().User}} | fl' + '; echo \'#-#-#-#\';'; cmd += 'query user'; util.powerShell(cmd).then(data => {