I know I can set the monitor timeout to 'never' using powercfg -change monitor-timeout-ac 0
However, how can I check what the value of monitor timeout is? Without setting it to a new value?
I know I can set the monitor timeout to 'never' using powercfg -change monitor-timeout-ac 0
However, how can I check what the value of monitor timeout is? Without setting it to a new value?
Perhaps this PowerShell example works for you, supposedly the GUIDs shouldn't change. The values would be represented in Minutes.
powercfg @(
'/query'
'381b4222-f694-41f0-9685-ff5bb260df2e'
'7516b95f-f776-4464-8c53-06167f40cc99'
'3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e'
) | Select-Object -Last 2 -Skip 1 | & {
begin { $out = [ordered]@{} }
process {
$key, $val = $_.Split(':').Trim()
$val = [int] $val / 60
if ($val -eq 0) {
$val = 'Never'
}
$out[$key] = $val
}
end {
$out
}
}
Note:
powercfg.exe
accepts-
and/
-prefixed parameter names interchangeably, and the case of the name doesn't matter; this answer uses-
and all-lowercase names.tl;dr
Unfortunately, this is more cumbersome than it should be:
Quick-and-dirty approach (assumes that your Windows display language is English):
Visually parse the last two lines, which will look something like this; the values are hex numbers, expressed in seconds.
0x00000000
means "Never":Programmatic, language-independent GUID approach:
powercfg -change monitor-timeout-ac ...
; again,0
represents "Never".Read on for an explanation and a convenience function that wraps the functionality.
Santiago's answer is a good start:
It demonstrates the - unfortunate - need to use a path of GUIDs to drill down to a setting of interest with powercfg.exe's
-query
(-q
) parameter; in other words: you unfortunately can not use the same symbolic names such asmonitor-timeout-ac
that the-change
(-x
) parameter supports.Additionally, the values are expressed (a) in hexadecimal form and (b) reported in seconds rather than the minute values you pass to
-change
(-x
); however, in both cases0
represents "Never"-change
(-x
) doesn't support all settings, however; targeting the remaining ones requires the-setacvalueindex
/-setdcvalueindex
parameters, which - like-query
- requires a path of GUIDs, and specifying the values in seconds.While the scheme-internal groups and settings have fixed GUIDs, the top-level GUID varies, based on the active scheme:
The active scheme can be one of the predefined ones (which have well-known GUIDs), or one of any number of potential custom ones (which are assigned new GUIDs on creation).
powercfg -list
lists all available schemes,powercfg -getactivescheme
the active one.Therefore, for instance, querying the active scheme's
monitor-timeout-ac
andmonitor-timeout-dc
values requires the following cumbersome solution (the fixed, schema-internal GUIDs are taken from the list in the bottom section):The above is obviously cumbersome; convenience function
Get-PowerCfg
eases the pain (source code in the next section; invoke it with-?
for help).E.g., running
Get-PowerCfg
with thePower saver
scheme in effect outputs the following on Windows 11; values are in minutes;0
represents "Never":Get-PowerCfg
function source code:List of all fixed, schema-internal GUIDs, for subgroups and their settings, as of Windows 11: