4

I would like to be able to fire a task before a windows server 2012 is reboot or shutdown.

I can see task scheduler supports an 'on startup' trigger. Unfortunately there is similar event for reboot or restart. Is there anyway I can achieve the my goal?

Anthony Kong
  • 2,976
  • 10
  • 53
  • 91
  • check this link , it's simple and quick way http://www.c-sharpcorner.com/UploadFile/cd7c2e/how-to-make-your-system-auto-shutdown-by-using-task-schedule/ – Jangali8 Sep 09 '15 at 08:47
  • OP is asking how to run a task AS the computer is shutting down, NOT how to run a task TO shut the computer down. – music2myear Jun 29 '17 at 17:38

1 Answers1

6

You cannot use the task scheduler for running scripts on shutdown, but you could instead use shutdown scripts supported by Group Policy. Shutdown scripts are run as Local System.

You can find them under Computer Configuration\Windows Settings\Scripts (Startup/Shutdown)

Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122