root\wmi - Monitor brightness
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