Allow wake timers Windows 7/Vista

前端 未结 4 1658
一生所求
一生所求 2021-02-11 06:18

I need to allow WakeTimers (computer wake up from sleep/hibernation) for all power plans set on plugged in to Enabled.

4条回答
  •  悲&欢浪女
    2021-02-11 06:59

    I wrote this powershell script to Enable or Disable wake timers on all current power schemes. On the second last line "POWERCFG -setacvalueindex $xAll $xSubGuid $zz 1" - the 1 means enable. Just change this to 0 to disable.

    CLS
    #Capture Current Active Power Scheme
    $orgScheme = POWERCFG -GETACTIVESCHEME  
    $yOrg = $orgScheme -split "\s+"
    $xOrg = $yOrg[3]
    Write-host Original Scheme = $xOrg
    Echo __________________________________
    Echo " "
    
    $allScheme = POWERCFG /L
    #Echo $allScheme
    
    foreach ($line in $allScheme)
      {
      if ($line.Length -gt 40)
            {
            if ($line.substring(0,5) -eq "Power")
                {
                $yAll = $line -split "\s+"
                $xAll = $yAll[3]
                write-host $xAll
                Powercfg -S $xAll
    
                $pScheme = POWERCFG /Q
                foreach ($line in $pScheme)
                    {
                    $yy = $line -split "\s+"
                    $xx = $yy[5]+$yy[6]+$yy[7]+$yy[8]
                    $zz = $yy[4]
                    $xSubGroup = $yy[1]
    
                    If($xSubGroup -eq "SubGroup")
                        {
                        $xSubGuid = $yy[3]
                        }
    
                    If($xx -eq "(allowwaketimers)")
                         {
                          write-host Power Scheme Guid = $xAll
                          write-host Subgroup Guid = $xSubGuid
                          write-host WakeUp Guid = $zz
                          Write-host POWERCFG -setacvalueindex $x $xSubGuid $zz 1
                          Echo " "
                          break
                         }
                    }
                POWERCFG -setacvalueindex $xAll $xSubGuid $zz 1
                }
            }
      }
    Powercfg -S $xOrg
    

    Enjoy.

提交回复
热议问题