Skip to content

Simple scripts to manage your GPU with Power Source. Turn GPU on when plugged in and turn GPU off when on battery!

Notifications You must be signed in to change notification settings

abh80/windows-gpu-management-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

windows-gpu-management-script

Simple scripts to manage your GPU with Power Source. Turn GPU on when plugged in and turn GPU off when on battery!

Tired of gpu induced battery drain? Do this

⚠️ Tested only on Windows 10 and 11. Use at your own risk

Usage

  • Clone the repo or the two files named disable_gpu.ps1 and enable_gpu.ps1 (Both are independent of each other).

  • Launch the Task Scheduler program on windows. (Preinstalled on all Windows version)

  • Task Scheduler Library > Create Task

  • Name is anything you want, I will name it Plug In Script. Enable the Run with highest privileges option

    Alt text

  • Click on the Triggers tab > New > Select On an event. Check the highlighted areas in the ASSETS/image below then click on New Event Filter

    Alt text

  • Select the XML tab and enable the Edit query manually option. Check the highlighted areas in the ASSETS/image below

    Alt text

  • Paste the following for Plug In:

    <QueryList>
    <Query Id="0" Path="System">
    	<Select Path="System">*[System[(EventID=105)]] and *[System[Provider[@Name="Microsoft-Windows-Kernel-Power"]]] and *[EventData[Data[@Name="AcOnline"] and (Data='true')]]</Select>
    </Query>
    </QueryList>
  • Click Ok then again Ok until you reach the Create Task window.

  • Check the ASSETS/image below for Settings and Conditions tab. This will be same for both Plugin In and Out script.

    Alt text

    Alt text

  • Click on Actions > New.

  • In the Program/Script enter your powershell install location, by default it is C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.

  • In the Add arguments enter -NoProfile -ExecutionPolicy Bypass -File "/path/to/enable_gpu.ps1" -Name "NVIDIA GeForce GTX 1650 Ti" (replace /path/to and NVIDIA GeForce GTX 1650 Ti to your needs).

    Alt text

  • Repeat the same for the disable_gpu.ps1 with the changes as necessary.

    Use this query for the Step 7:

    <QueryList>
    <Query Id="0" Path="System">
    <Select Path="System">*[System[(EventID=105)]] and *[System[Provider[@Name="Microsoft-Windows-Kernel-Power"]]] and *[EventData[Data[@Name="AcOnline"] and (Data='false')]]</Select>
    </Query>
    </QueryList>

Thank you for following this guide. If you are like me who has to save battery on a gaming laptop then this is perfect.

Credits

Big shoutout to this reddit post for providing with events!

About

Simple scripts to manage your GPU with Power Source. Turn GPU on when plugged in and turn GPU off when on battery!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published