For those who prefer to use the task scheduler, you can schedule the task to start after restarting / shutting down by configuring the task to start after registering event 1074 in the system log in the event viewer. However, this is only suitable for very short tasks that will be performed while the system reboots / shuts down, which usually takes only a few seconds.
- From the task scheduler:
Begin the task: On an event
Log: system
Source: USER32
EventID: 1074
- From the command line:
schtasks / create / tn "taskname" / tr "task file" / sc onevent / ec system / mo * [system / eventid = 1074]
Comment: The / ec option is available on Windows Vista and later. (thanks @ t2d)
Please note that the status of the task may be as follows:
The requested operation did not complete because the user was not logged on to the network. The specified service does not exist. (0x800704DD)
However, this does not mean that it did not start.
Oz Edri Dec 06 '14 at 1:59 2014-12-06 01:59
source share