Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

As of writing, the only options available are to "Begin the task"

  • On a schedule
  • At logon
  • At startup
  • On idle
  • On an event
  • At task modification/creation
  • On connect to user session
  • On disconnect from user session
  • On workstation lock
  • On workstation unlock
share|improve this question

2 Answers 2

You can create shutdown tasks with the Group Policy Editor in Windows 7.

share|improve this answer

Even though this is an older thread, I'd like to add a solution I devised that works well.

I wanted to run a script or batch file whenever a shutdown or restart was initiated, but I didn't want to use Group Policies Shutdown Scripts function. The reason for this was pretty in depth, but I basically needed to run a script before certain services were closed.

I ended up creating a scheduled task as follows:

  • Type : On Event (Basic)
  • Log : System
  • Source : User32
  • EventID : 1074

When a user or command initiates a shutdown or restart as a logged on user or on a user's behalf, event ID 1074 will fire. By creating a task to use this to trigger a script, it will start the script and allow it to finish, however it will only report the task as "running" or "triggered" in the logs. I have not used this with a long script, so it may be worth testing further, but it works great for short scripts.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.