WmiSetBrightness method of the WmiMonitorBrightnessMethods class
The WmiSetBrightness method sets the display brightness of a computer monitor.
Syntax
uint32 WmiSetBrightness(
uint32 Timeout,
uint8 Brightness
);
Parameters
-
Timeout
-
Timeout, in seconds.
-
Brightness
-
Brightness, in percent.
Return value
Returns zero (0) to indicate success. Any other number indicates an error. For more information about error codes, see WMI Error Constants or WbemErrorEnum.
Examples
For an extended discussion of retrieving and setting monitor brightness, see the Scripting Guy's Use PowerShell to Report and Set Monitor Brightness blog topic.
The following PowerShell sample sets the brightness of the monitor to 50%.
$brightness = 50
$delay = 5
$myMonitor = Get-WmiObject -Namespace root\wmi -Class WmiMonitorBrightnessMethods
$myMonitor.wmisetbrightness($delay, $brightness)
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista |
Minimum supported server |
Windows Server 2008 |
Namespace |
Root\wmi |
MOF |
|
DLL |
|