Schedule a command at logoff before applications terminate

1

Is there a way to schedule a task to run at logoff but before windows sends the terminate signal to applications?

I need to pass a command to a running VirtualBox VM (host system being Windows8 pro) so the VM will close and save it's current state. Looking in Task Sheduler, i can't find a trigger for logoff (unless there is an journal entry i can link to, but then i didn't found it either). I tried using gpedit.msc but Group Policy scripts appear to run after the termination signal is sent. This causes windows to try and close my VM before the command handles it and brings me back to the desktop because VirtualBox won't auto-save the VM.

r0k

Posted 2013-01-29T11:29:50.380

Reputation: 53

2Thanks. Yes, i didn't consider going the other way and using the script to shutdown but it's probably the easiest work-around. I'll wait to see if someone comes with another option than try to find out how to mark a post as answer. I don't see any button to do this. – r0k – 2013-02-01T11:49:33.480

Ok, I posted it as an answer instead, since you can't accept comments as answers. If you don't get a better solution you can accept it if you wish. – Karan – 2013-02-01T19:43:40.257

Answers

1

I don't think this is possible. What you can do instead is create a batch file/script that executes your commands and finally initiates logoff (using shutdown.exe or something else).

Another option would be to use a program like Karen's Show Stopper, which essentially does the same thing:

1

Karan

Posted 2013-01-29T11:29:50.380

Reputation: 51 857

Well, looke like there is no way to do what i wanted. This is an easy enough work-around. Thanks – r0k – 2013-02-08T10:03:22.280