Consultar configurações atuais de configuração de energia no Windows 7

2

O Powercfg permite definir certas configurações como monitor-timeout-ac e standby-timeout-dc usando powercfg -change <setting> <value> . É possível consultar os valores atuais dessas configurações? Analisei o texto da ajuda, mas não vi o caminho do comando powercfg . Talvez haja outro comando que possa fornecer o estado atual?

    
por TwistedTech 09.04.2014 / 17:15

4 respostas

1

Para consultar seções específicas relacionadas às configurações específicas mencionadas, faça o seguinte:

  • powercfg -list para obter uma lista dos GUIDs do plano de energia atual. Nota / Copie o GUID para o plano que você deseja consultar.
  • powercfg -aliases para obter uma lista de GUIDs para subseções do plano. Nota / Copie os GUIDs para "SUB_SLEEP" e "SUB_VIDEO".
  • powercfg -query <GUID of power plan> <GUID of sub-section> .

Exemplo de saída da subseção "SUB-SLEEP":

C:\Windows\system32>powercfg -query 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 238c9fa8-0aad-41ed-83f4-97be242c8f20

Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance)
  Subgroup GUID: 238c9fa8-0aad-41ed-83f4-97be242c8f20  (Sleep)
    Power Setting GUID: 29f6c1db-86da-48c5-9fdb-f2b67b1f44da  (Sleep after)
      Minimum Possible Setting: 0x00000000
      Maximum Possible Setting: 0xffffffff
      Possible Settings increment: 0x00000001
      Possible Settings units: Seconds
    Current AC Power Setting Index: 0x00000000
    Current DC Power Setting Index: 0x00000000

    Power Setting GUID: 94ac6d29-73ce-41a6-809f-6363ba21b47e  (Allow hybrid sleep)
      Possible Setting Index: 000
      Possible Setting Friendly Name: Off
      Possible Setting Index: 001
      Possible Setting Friendly Name: On
    Current AC Power Setting Index: 0x00000001
    Current DC Power Setting Index: 0x00000001

    Power Setting GUID: 9d7815a6-7ee4-497e-8888-515a05f02364  (Hibernate after)
      Minimum Possible Setting: 0x00000000
      Maximum Possible Setting: 0xffffffff
      Possible Settings increment: 0x00000001
      Possible Settings units: Seconds
    Current AC Power Setting Index: 0x00000000
    Current DC Power Setting Index: 0x00000000

    Power Setting GUID: bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d  (Allow wake timers)
      Possible Setting Index: 000
      Possible Setting Friendly Name: Disable
      Possible Setting Index: 001
      Possible Setting Friendly Name: Enable
    Current AC Power Setting Index: 0x00000001
    Current DC Power Setting Index: 0x00000001

Exemplo de seção "SUB_VIDEO":

C:\Windows\system32>powercfg -query 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 7516b95
f-f776-4464-8c53-06167f40cc99

Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance)
  Subgroup GUID: 7516b95f-f776-4464-8c53-06167f40cc99  (Display)
    Power Setting GUID: 17aaa29b-8b43-4b94-aafe-35f64daaf1ee  (Dim display after)
      Minimum Possible Setting: 0x00000000
      Maximum Possible Setting: 0xffffffff
      Possible Settings increment: 0x00000001
      Possible Settings units: Seconds
    Current AC Power Setting Index: 0x00000258
    Current DC Power Setting Index: 0x0000012c

    Power Setting GUID: 3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e  (Turn off display after)
      Minimum Possible Setting: 0x00000000
      Maximum Possible Setting: 0xffffffff
      Possible Settings increment: 0x00000001
      Possible Settings units: Seconds
    Current AC Power Setting Index: 0x00000384
    Current DC Power Setting Index: 0x00000258

    Power Setting GUID: aded5e82-b909-4619-9949-f5d71dac0bcb  (Display brightness)
      Minimum Possible Setting: 0x00000000
      Maximum Possible Setting: 0x00000064
      Possible Settings increment: 0x00000001
      Possible Settings units: %
    Current AC Power Setting Index: 0x00000064
    Current DC Power Setting Index: 0x00000064

    Power Setting GUID: f1fbfde2-a960-4165-9f88-50667911ce96  (Dimmed display brightness)
      Minimum Possible Setting: 0x00000000
      Maximum Possible Setting: 0x00000064
      Possible Settings increment: 0x00000001
      Possible Settings units: %
    Current AC Power Setting Index: 0x0000001e
    Current DC Power Setting Index: 0x0000001e
    
por 09.04.2014 / 17:36
0

Sim. Surpreendentemente, está usando a seguinte configuração:

powercfg -query

Aqui está um trecho do comando powercfg -? |more :

POWERCFG <command line options>
Description:
  This command line tool enables users to control the power settings
  on a system.

Parameter List:
  -LIST, -L   Lists all power schemes in the current user's environment.

          Usage: POWERCFG -LIST

  -QUERY, -Q  Displays the contents of the specified power scheme.

          Usage: POWERCFG -QUERY <SCHEME_GUID> <SUB_GUID>

          <SCHEME_GUID>  (optional) Specifies the GUID of the power scheme
                         to display, can be obtained by using powercfg -l.
          <SUB_GUID>     (optional) Specifies the GUID of the subgroup
                         to display.  Requires a SCHEME_GUID to be provided.

          If neither SCHEME_GUID or SUB_GUID are provided, the settings
          of the current user's active power scheme are displayed.
          If SUB_GUID is not specified, all settings in the specified
          power scheme are displayed.

Espero que isso ajude. :)

    
por 09.04.2014 / 17:23
0

Eu sei que esta é uma pergunta antiga, mas não houve resposta que atendesse às minhas necessidades. Depois de muito pesquisar e brincar com a saída, eu criei o seguinte script para atender às minhas necessidades. Ele adquire a hora de dormir (enquanto com a energia CA - conectada) e o tempo de hibernação (enquanto a energia CA está conectada) e retorna ambos. Eu precisava desses valores para o meu cenário, mas você pode olhar para a saída de $options e usar esse código como um modelo para obter quaisquer outros dados necessários:

#Get GUID of active plan
$GUID = (((Get-CimInstance -classname Win32_PowerPlan -Namespace "root\cimv2\power" | where {$_.IsActive -eq "true"}).InstanceID) -split("\"))[1]
#Cut {} off of string at beginning and end of GUID
$GUID = $GUID.Substring(1, $GUID.Length-2)

#Get a list of all options for this plan
$Options = powercfg -query $GUID
$index = 0

#Find index of line that contains Sleep Settings
For($i=0; $i -lt $Options.Length; $i++)
{
    $line = $Options[$i]
    if($line.ToLower() -like "*sleep after*")
    {
        $index = $i
        break
    }        
}

#AC Setting is 6 lines later
$sleepSetting = $Options[$index + 6]
#trim off the beginning of the string, leaving only the value
$sleepSettingTrimmed = $sleepSetting.Substring($sleepSetting.IndexOf(":")+2)

#output should now be "0x00000000" if off, or another number representing minutes

#Find index of line that contains Hibernate Settings
For($i=0; $i -lt $Options.Length; $i++)
{
    $line = $Options[$i]
    if($line.ToLower() -like "*hibernate after*")
    {
        $index = $i
        break
    }        
}

#AC Setting is 6 lines later
$hibernateSetting = $Options[$index + 6]
#trim off the beginning of the string, leaving only the value
$hibernateSettingTrimmed = $hibernateSetting.Substring($hibernateSetting.IndexOf(":")+2)

echo "$sleepSettingTrimmed $hibernateSettingTrimmed"
    
por 13.12.2016 / 15:35
-1
# get current power sleep time setting
# I know of no other way to return the single number of the sleep time
# (powershell)
# run script with "powershell -file" to get errorlevel set right

# (Balanced plan) (Sleep section)
# can't do (Sleep after subsection guid) too?
$result = powercfg -query 381b4222-f694-41f0-9685-ff5bb260df2e 238c9fa8-0aad-41ed-83f4-97be242c8f20

# line 8, 7th word, in hex, cast to decimal
[int64]$sleeptime = ($result[7] -split ("\s+"))[6]

# return sleep time in minutes in errorlevel
exit $sleeptime/60
    
por 31.10.2016 / 23:34