diff --git a/lib/audio.js b/lib/audio.js index ac57194..ab283fb 100644 --- a/lib/audio.js +++ b/lib/audio.js @@ -191,7 +191,7 @@ function audio(callback) { }); } if (_windows) { - util.powerShell('Get-WmiObject Win32_SoundDevice | select DeviceID,StatusInfo,Name,Manufacturer | fl').then((stdout, error) => { + util.powerShell('Get-CimInstance 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 05f7d5c..060a026 100644 --- a/lib/battery.js +++ b/lib/battery.js @@ -225,9 +225,9 @@ module.exports = function (callback) { if (_windows) { try { const workload = []; - 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')); + workload.push(util.powerShell('Get-CimInstance Win32_Battery | select BatteryStatus, DesignCapacity, DesignVoltage, EstimatedChargeRemaining, DeviceID | fl')); + workload.push(util.powerShell('(Get-CimInstance -Class BatteryStaticData -Namespace ROOT/WMI).DesignedCapacity')); + workload.push(util.powerShell('(Get-CimInstance -Class BatteryFullChargedCapacity -Namespace ROOT/WMI).FullChargedCapacity')); util.promiseAll( workload ).then((data) => { diff --git a/lib/bluetooth.js b/lib/bluetooth.js index ad0866f..63b592e 100644 --- a/lib/bluetooth.js +++ b/lib/bluetooth.js @@ -204,7 +204,7 @@ function bluetoothDevices(callback) { }); } if (_windows) { - util.powerShell('Get-WmiObject Win32_PNPEntity | select PNPClass, Name, Manufacturer | fl').then((stdout, error) => { + util.powerShell('Get-CimInstance Win32_PNPEntity | select PNPClass, Name, Manufacturer | fl').then((stdout, error) => { if (!error) { const parts = stdout.toString().split(/\n\s*\n/); parts.forEach((part) => { diff --git a/lib/cpu.js b/lib/cpu.js index eea5dbf..9326b82 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -810,8 +810,8 @@ function getCpu() { if (_windows) { try { const workload = []; - 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-CimInstance Win32_processor | select Name, Revision, L2CacheSize, L3CacheSize, Manufacturer, MaxClockSpeed, Description, UpgradeMethod, Caption, NumberOfLogicalProcessors, NumberOfCores | fl')); + workload.push(util.powerShell('Get-CimInstance Win32_CacheMemory | select CacheType,InstalledSize,Level | fl')); workload.push(util.powerShell('(Get-CimInstance Win32_ComputerSystem).HypervisorPresent')); Promise.all( @@ -1207,7 +1207,7 @@ function cpuTemperature(callback) { } if (_windows) { try { - util.powerShell('Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | Select CurrentTemperature').then((stdout, error) => { + util.powerShell('Get-CimInstance MSAcpi_ThermalZoneTemperature -Namespace "root/wmi" | Select CurrentTemperature').then((stdout, error) => { if (!error) { let sum = 0; let lines = stdout.split('\r\n').filter(line => line.trim() !== '').filter((line, idx) => idx > 0); @@ -1448,7 +1448,7 @@ function cpuCache(callback) { } if (_windows) { try { - util.powerShell('Get-WmiObject Win32_processor | select L2CacheSize, L3CacheSize | fl').then((stdout, error) => { + util.powerShell('Get-CimInstance Win32_processor | select L2CacheSize, L3CacheSize | fl').then((stdout, error) => { if (!error) { let lines = stdout.split('\r\n'); result.l1d = 0; @@ -1458,7 +1458,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-CimInstance 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 419caa1..173c3f0 100644 --- a/lib/filesystem.js +++ b/lib/filesystem.js @@ -152,7 +152,7 @@ function fsSize(callback) { if (_windows) { try { // util.wmic('logicaldisk get Caption,FileSystem,FreeSpace,Size').then((stdout) => { - util.powerShell('Get-WmiObject Win32_logicaldisk | select Caption,FileSystem,FreeSpace,Size | fl').then((stdout, error) => { + util.powerShell('Get-CimInstance 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) { @@ -425,7 +425,7 @@ 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-WmiObject Win32_logicaldisk | select Caption,DriveType,Name,FileSystem,Size,VolumeSerialNumber,VolumeName | fl').then((stdout, error) => { + // util.powerShell('Get-CimInstance 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/); @@ -1193,7 +1193,7 @@ function diskLayout(callback) { if (_windows) { try { const workload = []; - workload.push(util.powerShell('Get-WmiObject Win32_DiskDrive | select Caption,Size,Status,PNPDeviceId,BytesPerSector,TotalCylinders,TotalHeads,TotalSectors,TotalTracks,TracksPerCylinder,SectorsPerTrack,FirmwareRevision,SerialNumber,InterfaceType | fl')); + workload.push(util.powerShell('Get-CimInstance Win32_DiskDrive | select Caption,Size,Status,PNPDeviceId,BytesPerSector,TotalCylinders,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 { diff --git a/lib/graphics.js b/lib/graphics.js index e5d98b5..5a88f2a 100644 --- a/lib/graphics.js +++ b/lib/graphics.js @@ -772,9 +772,9 @@ function graphics(callback) { // https://devblogs.microsoft.com/scripting/use-powershell-to-discover-multi-monitor-information/ try { const workload = []; - workload.push(util.powerShell('Get-WmiObject win32_VideoController | fl *')); + workload.push(util.powerShell('Get-CimInstance win32_VideoController | fl *')); workload.push(util.powerShell('gp "HKLM:\\SYSTEM\\ControlSet001\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}\\*" -ErrorAction SilentlyContinue | where MatchingDeviceId $null -NE | select MatchingDeviceId,HardwareInformation.qwMemorySize | fl')); - workload.push(util.powerShell('Get-WmiObject win32_desktopmonitor | fl *')); + workload.push(util.powerShell('Get-CimInstance win32_desktopmonitor | fl *')); workload.push(util.powerShell('Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorBasicDisplayParams | fl')); workload.push(util.powerShell('Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.Screen]::AllScreens')); workload.push(util.powerShell('Get-CimInstance -Namespace root\\wmi -ClassName WmiMonitorConnectionParams | fl'));