Thank you for this
Just wanted to add on to this since it didn't cover restart's.
https://stackoverflow.com/questions/101647/how-to-schedule-a-task-to-run-when-shutting-down-windows
"For those who prefer using the Task Scheduler, it's possible to schedule a task to run after a restart / shutdown has been initiated by setting the task to run after event 1074 in the System log in the Event Viewer has been logged. However, it's only good for very short task, which will run as long as the system is restarting / shutting down, which is usually only a few seconds.
From the Task Scheduler:
Oz Edri"
That's Start, Run "taskschd.msc",
Create basic task
Give it a name, Click next
Trigger: When a specific even is logged; Click next
Log: System (you can type S, then down arrow x3 should get you there too)
Source: USER32 (not sure if its case sensitive, but I used all caps)
Event ID: 1074; Click next (1074 is the log for shutdown's and restarts)
Action: Start a program; Click next
Program/script: Select your disable .bat file from the first url. Leave "Add arguments" and "Start in" blank. Click next
Verify the information is correct then click Finish.
Can only confirm working on win10x64 w/ rx460 multiple reboots and restarts have all worked flawlessly. I however have not had the chance for a windows update to fully "test" it, but I think it would still work.