Skip to content

Instantly share code, notes, and snippets.

@opentechnologist
Created October 28, 2023 23:21
Show Gist options
  • Save opentechnologist/40d4a217ed538bdc4279f391c7eab152 to your computer and use it in GitHub Desktop.
Save opentechnologist/40d4a217ed538bdc4279f391c7eab152 to your computer and use it in GitHub Desktop.
a simple PowerShell script to adjust the screen display's brightness.
<#
.SYNOPSIS
Adjust screen display brightness.
.DESCRIPTION
This script adjusts the screen display's brightness by accepting
a percentage value between 0 and 100 indicating the strength of
the brightness the screen display's backlight should emit.
A default value of 40% brightness is applied if nothing is passed.
.USAGE
C:\path\to\scripts\folder\brightness.ps1 70
#>
Param([Int16]$brightness=40)
If ($brightness -in 0..100) {
(Get-WmiObject -Namespace root\WMI -Class WmiMonitorBrightnessMethods).WmiSetBrightness(1, $brightness)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment