When I want to run a program (.exe \ .bat) before Windows 7 Home Premium Logoff \ Restart I use the Task Scheduler and I set a custom event: Log:
System, Source:
Winlogon, Event ID:
7002 \ 4634 \ 4647 \ .....
The problem is that the program starts but the system closes before the program finishes, while it's running.
What can I do? (My O.S doesn't have gpedit.msc unfortunately)
shutdown /a
to the start of the script (to abort the current shutdown), and then addshutdown -s -t 00
to the end of it to initiate a new shutdown sequence when it's done. You may have to make a couple scripts or something to deal with reboot vs. shutdown vs. hibernation, etc. Are you on an Active Directory domain by any chance?