From my understanding windows gives applications/processes or running tasks 2 seconds before it cuts the lights out. Windows sends a command that the program or scheduled task may or may not understand. This being said it may give you the option to keep it running but if not you may want to find a better way to run what you need it to do. You could however keep the task running every 30 minutes and when the computer is shut down or turned on you could setup a start up and shutdown script.
Referenced here.
For Startup/Shutdown:
Run gpedit.msc (Local Policies) Computer Configuration -> Windows Settings -> Scripts -> Startup or Shutdown -> Properties -> Add For Logon/Logoff:
Run gpedit.msc (Local Policies) User Configuration -> Windows Settings -> Scripts -> Logon or Logoff -> Properties -> Add
Hope this is helpful.