Screen Dimming

I’m writing a script that does some basic set up of computers that come into my office before sending them out for deployment. One of the setting changes that I’m having trouble with is the timing on screen dimming for laptops. I found this function somewhere on the Hey scripting guy forum to return all the guid’s in the currently active power scheme.

Function Get-PowerSettings{
$plan = Get-WmiObject -Class win32_powerplan -Namespace root\cimv2\power -Filter "isActive='true'"
$regex = [regex]"{(.*?)}$"
$planGuid = $regex.Match($plan.instanceID.Tostring()).groups[1].value

I don’t know how the regular expression above works but I can see that it does because

powercfg -query $planGuid 
returns a complete list of power settings for the currently active scheme. Thanks Scripting Guy! What I’m trying to do is pull one particular setting from the list and change the time frame for dimming the screen when under battery power, and ac power. Piping that command to Get-Member tells me that the only property I can select is length so I’m not sure how to isolate the particular setting I need, which is “dim display after”.

Basically here is how I change the other power settings.

powercfg -change -monitor-timeout-ac 30
powercfg -change -standby-timeout-ac 0

Is there a way that is this easy to get the dim time settings as well, and I just haven’t found it yet?


I don’t seem to have this setting on my Windows 8.1 PC, but it’s probably because this is a desktop without an integrated display (no dimming). Try this:

$numberOfSeconds = 60
powercfg /SETACVALUEINDEX $planguid SUB_VIDEO VIDEODIM $numberOfSeconds

That would be for AC. For DC, it’s just /SETDCVALUEINDEX.

Using powercfg is a bit tricky; it’s an old command-line tool with somewhat obscure syntax (some GUIDs, some aliases, not all documented very well.)

Thanks Dave,

I’ll give that a shot and let you know if it works.