Setting Monitor Brightness

by Sep 27, 2013

If your display driver supports WMI, then you can change the display brightness using PowerShell – event on remote machines!

Here's the function:

function Set-MonitorBrightness
{
    param
    (
        [Parameter(Mandatory=$true)]
        [Int][ValidateRange(0,100)]
        $Value,

        $ComputerName, 
        $Credential
    )

    $null = $PSBoundParameters.Remove('Value')

    $helper = Get-WmiObject -Namespace root/WMI -Class WmiMonitorBrightnessMethods @PSBoundParameters 
    $helper.WmiSetBrightness(1, $Value)
}

Simply specify a value in the range of 0 to 100 and see your display brightness change. Supply remote computer machine name(s) or IP address(es) to the -ComputerName parameter, and surprise your colleagues with a remotely dimmed display or dim all displays during lunch break (as usual, WMI remote access requires local Administrator privileges and that you have set up a remote administration firewall rule).

If you get a "not supported" error message, then your display driver unfortunately came without WMI support.

This could be the "fun" part: simulating a flaky display:

for($x=0 $x -lt 20 $x++)
{    
    Set-MonitorBrightness -Value (Get-Random -Minimum 20 -Maximum 101)  
    Start-Sleep -Seconds 1    
}

Twitter This Tip! ReTweet this Tip!