0

I have a second external display and am trying to set the display brightness using powershell.

I can easily set the brightness for the Primary (built-in) display, using the following:

# Get CIM object for Primary Display
$m = Get-CimInstance -Namespace root/WMI -ClassName WmiMonitorBrightnessMethods

# List Primary display's properties
$m | select *

# Set brightness and timeout of primary display object
Invoke-CimMethod $m -MethodName WmiSetBrightness -Arguments @{Brightness = 80; Timeout = 1}

However, I can see the same type of object using WmiMonitorDescriptorMethods, which shows both my displays.

# List ALL displays by InstanceName
Get-Ciminstance -Namespace root/WMI -ClassName WmiMonitorDescriptorMethods

# See details of each
$k = Get-Ciminstance -Namespace root/WMI -ClassName WmiMonitorDescriptorMethods
$k | select *

But I am not able to use the 2nd display instance (given by InstanceName).

How can I change the brightness of the 2nd display instance?

8
  • You can call the SetMonitorBrightness Function Commented Aug 14, 2024 at 22:38
  • @SantiagoSquarzon Ok, so how do you use that? Can you post an example? The link does have anything useful for PowerShell. Commented Aug 15, 2024 at 0:10
  • You can Add-Type the class from this answer: stackoverflow.com/a/61417175/15339544 and use it to set all monitors brightness Commented Aug 15, 2024 at 0:45
  • Using inline C# seem a bit too hackish. Sure would probably work, but I'm looking for a pure and more clean posh (!) solution. I don't understand why you can change brightness in 1-2 lines of primary display, but can't do the same for a 2nd... Commented Aug 15, 2024 at 0:57
  • You can't use the $k instance of the 2nd monitor, maybe $k[1]? Commented Aug 15, 2024 at 14:41

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.