-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecrease.ps1
More file actions
17 lines (12 loc) · 750 Bytes
/
decrease.ps1
File metadata and controls
17 lines (12 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[int]$newBrightness=-15
# Get current display brightness using WMI
$currentBrightness = (Get-CimInstance -Namespace root/WMI -ClassName WmiMonitorBrightness)
# Extract the current brightness value
$currentBrightnessValue = $currentBrightness.CurrentBrightness
# Print the current brightness value
Write-Host "Current Display Brightness: $currentBrightnessValue"
# Calculate the new brightness value by adding the adjustment
$newBrightnessValue = [math]::max(0, [math]::min(100, $currentBrightnessValue + $newBrightness))
Write-Host "New Display Brightness: $newBrightnessValue"
# Adjust display brightness using WMI
(Get-WmiObject -Namespace root/WMI -Class WmiMonitorBrightnessMethods).WmiSetBrightness(1, $newBrightnessValue)