How to pass WMIC parameters for WmiSetBrightness

849 Views Asked by At

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?

1

There are 1 best solutions below

0
Eli Finkel On

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.