2
I would like to run a script in Windows right before standby/sleep mode with admin rights and blocking, i.e., the system should not go to sleep until the script has successfully terminated.
Alternatively, it would be possible for me to create a background process or service if it can be done in a simple manner.
Background: It seems I have a very buggy driver for a device which leaves Windows hanging with a blank screen when going to standby or presents a blank screen upon wakeup. This is not 100% reproduceable, it happens only sometimes. However, it seems when I just disable the corresponding device in the device manager, everything works fine. I would like to automate this process.
Thanks, great pointer but this only works for shutdown. I would need it for standby and sleep mode. – divB – 2015-08-22T18:05:58.173
1@divB Answer updated to use Task Scheduler to run a script on the appropriate Kernel-Power event (EventID 42 is Sleep). – DavidPostill – 2015-08-22T19:46:03.257
@divb Note standby and mode are the same thing. See What is the difference between Sleep and Standby modes?
– DavidPostill – 2015-08-22T19:51:34.280This works now for standby which is great but it is not blocking: For a test, I just let execute calc.exe. When I switch to standby, calc.exe pops up potentially long after I resumed again! Since the buggy driver leaves the system hanging when it goes to standby, I need to disable it before it actually goes into standby. – divB – 2015-08-23T19:14:06.803