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
-
Clone the repo or the two files named
disable_gpu.ps1
andenable_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 theRun with highest privileges option
-
Click on the
Triggers
tab > New > SelectOn an event
. Check the highlighted areas in the ASSETS/image below then click onNew Event Filter
-
Select the
XML
tab and enable theEdit query manually option
. Check the highlighted areas in the ASSETS/image below -
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 againOk
until you reach theCreate Task
window. -
Check the ASSETS/image below for
Settings
andConditions
tab. This will be same for both Plugin In and Out script. -
Click on
Actions
>New
. -
In the
Program/Script
enter your powershell install location, by default it isC:\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
andNVIDIA GeForce GTX 1650 Ti
to your needs). -
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.
Big shoutout to this reddit post for providing with events!