header image

root\wmi–set monitor brightness

Posted by: | June 23, 2011 | 1 Comment |

Oddly the methods for changing the brightness aren’t on the WmiMonitorBrightness we get a separate class with the methods. This function can be used to set the brightness

function set-monitorBrightness {
[CmdletBinding()]
param (
[ValidateRange(5,20)]
[int]$timeout=5,
 
[ValidateRange(0,100)]
[int]$brightness
)
$monitors = Get-WmiObject -Namespace root\wmi -Class WmiMonitorBrightnessMethods

foreach ($monitor in $monitors){
  $monitor.WmiSetBrightness($timeout, $brightness)  
}    
}

 

Timeout is in seconds and is the time the change takes.  Set to 20 and watch a slow change

Brightness is the % brightness setting. The system will set the brightness to the nearest level available (see previous post)

under: PowerShell and WMI, Technology

1 Comment

  1. By: Keith on October 2, 2012 at 5:09 pm      

    You’ve saved me a lot of time with this one Richard! Many thanks.