If you have 2 monitors, then the WMI call is probably returning 2 objects.
Try this.
Get-WmiObject -namespace root/wmi -class WmiMonitorBrightnessMethods | foreach {
$_.wmisetbrightness(80,20)
}
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I want to change the brightness of my screens (I have two screens) on my desktop computer using PowerShell. I use this command:
(Get-WmiObject -namespace root/wmi -class WmiMonitorBrightnessMethods).wmisetvrightness(1,20)
and I get an error :
Get-WmiObject : Not supported
At line:1 char:2
+ (Get-WmiObject -namespace root/wmi -class WmiMonitorBrightnessMethods ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], ManagementException
+ FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
You cannot call a method on a null-valued expression.
At line:1 char:1
+ (Get-WmiObject -namespace root/wmi -class WmiMonitorBrightnessMethods ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
I use the same command on my laptop and it works.
I would like to know why I get this error and how to fix it.
I know that my computer does not programmatically support changing the brightness and I know that there are free third-party programs that perform this operation, yet I want to understand how they do it and what command those programs use.
I ask because I want to build software that reduces screen brightness.
If you have 2 monitors, then the WMI call is probably returning 2 objects.
Try this.
Get-WmiObject -namespace root/wmi -class WmiMonitorBrightnessMethods | foreach {
$_.wmisetbrightness(80,20)
}
I know that my computer does not programmatically support changing the brightness and I know that there are free third-party programs that perform this operation, yet I want to understand how they do it and what command those programs use.
It can be done with GetVCPFeatureAndVCPFeatureReply / SetVCPFeature
Brightness is 0x10 code (you can test codes with ClickMonitorDDC tool)
Are you running Windows Powershell 5, or the multi-platform PowerShell 7? WMI isn't part of PowerShell 7.