header image

root\wmi – Monitor brightness

Posted by: | June 23, 2011 | 4 Comments |

The monitor brightness can be discovered like this

function get-monitorBrightness {

$monitors = Get-WmiObject -Namespace root\wmi -Class WmiMonitorBrightness

foreach ($monitor in $monitors){
  $brightness = New-Object -TypeName PSObject -Property @{
        CurrentLevel = $monitor.CurrentBrightness
        MaxLevel = $($monitor.Level | sort | select -Last 1)
     }
  $brightness  
}    
}

 

The WmiMonitorBrightness class is used. The level property holds the brightness levels that can be set. A simple sort ensures we get the maximum setting

under: PowerShell and WMI, Technology

4 Comments

  1. By: Vadims Podans on June 26, 2011 at 9:27 am      

    Unfortunately this won’t work for me on my Windows 7 box. WMI query throws an exception:
    [↓] [vPodans] gwmi -Namespace root\wmi -class WmiMonitorBrightness
    Get-WmiObject : Not supported
    At line:1 char:5
    + gwmi <<<< -Namespace root\wmi -class WmiMonitorBrightness + CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

  2. By: RichardSiddaway on June 26, 2011 at 1:11 pm      

    It depends on whether your monitor supports the WMI interface – I’ve seen the same results on Windows 7 systems

  3. By: Vadims Podans on June 27, 2011 at 12:26 am      

    It seems that neither of my monitors (notebook and Samsung SyncMaster) supports these classes.

  4. By: Ignacio Baca Moreno-Torres on July 27, 2011 at 4:47 am      

    My Dell laptop support these classes, and operates correctly, but is it possible to change the Level parameter, so I can use levels lower than the minimum? In my laptop min level is 6. Thanks.