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.ps1andenable_gpu.ps1(Both are independent of each other). -
Launch the
Task Schedulerprogram 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
Triggerstab > New > SelectOn an event. Check the highlighted areas in the ASSETS/image below then click onNew Event Filter -
Select the
XMLtab 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
Okthen againOkuntil you reach theCreate Taskwindow. -
Check the ASSETS/image below for
SettingsandConditionstab. This will be same for both Plugin In and Out script. -
Click on
Actions>New. -
In the
Program/Scriptenter your powershell install location, by default it isC:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe. -
In the
Add argumentsenter-NoProfile -ExecutionPolicy Bypass -File "/path/to/enable_gpu.ps1" -Name "NVIDIA GeForce GTX 1650 Ti"(replace/path/toandNVIDIA GeForce GTX 1650 Tito your needs). -
Repeat the same for the
disable_gpu.ps1with 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!





