How to pass WMIC parameters for WmiSetBrightness
Asked Answered
C

1

2

The following line in PowerShell works (brightness changes to 30):

(Get-WmiObject -Namespace root\wmi -Class WmiMonitorBrightnessMethods).WmiSetBrightness(0,30)

However, when using WMIC I get the following error:

C:\>wmic /NAMESPACE:\\root\wmi PATH WmiMonitorBrightnessMethods CALL WmiSetBrightness Brightness=30 Timeout=0
Executing (WmiMonitorBrightnessMethods)->WmiSetBrightness()
ERROR:
Description = Invalid method Parameter(s)

What is the issue and how can I get this to work?

Connaught answered 13/1, 2021 at 17:43 Comment(0)
C
3

Turns out it works if I add a WHERE clause:

C:\>wmic /NAMESPACE:\\root\wmi PATH WmiMonitorBrightnessMethods WHERE "Active=TRUE" CALL WmiSetBrightness Brightness=30 Timeout=0
Executing (\\MY-HOSTNAME\root\wmi:WmiMonitorBrightnessMethods.InstanceName="DISPLAY\\...\\...")->WmiSetBrightness()
Method execution successful.

Not very intuitive, to say the least, but oh well.

Connaught answered 14/1, 2021 at 15:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.