Created
October 28, 2023 23:21
-
-
Save opentechnologist/40d4a217ed538bdc4279f391c7eab152 to your computer and use it in GitHub Desktop.
a simple PowerShell script to adjust the screen display's brightness.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.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