Home > PowerShell > Powershell: Change monitor brightness

Powershell: Change monitor brightness

Recently I came across a method using which you can control the monitor brightness. This method uses the WMI class named “WMIMonitorBrightnessMethods” which lies under rootwmi. This WMI classes offers various other functions using which you can manage various parameters of monitor brightness

Here is the example code:

function Set-MonitorBrighness {
[CmdletBinding()]
param (
[ValidateRange(0,100)]
[int]$brightness
)            

$mymonitor = Get-WmiObject -Namespace rootwmi -Class WmiMonitorBrightnessMethods
$mymonitor.wmisetbrightness(5,$brightness)
}
Set-MonitorBrighness -brightness 1

 

This sets the monitor brightness level to 1%. The first parameter of the “wmisetbrightness” function is timeout which defines the time it takes to switch to the brightness one you have set.

No related content found.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>