basildane / WakeOnLAN

Wake On LAN, WakeOnLAN, shutdown software for Windows. A powerful WOL, ping, shutdown, GUI application.
http://wol.aquilatech.com
Other
998 stars 147 forks source link

Unable to create schedule task #109

Open monkey8113 opened 6 years ago

monkey8113 commented 6 years ago

Creating any task, would give error about [register task definition] (41,4):Logon Type: or [register task definition] value does not fall within the expected range.

Wake up and shut down is working if done manually. not sure if it will work in Task Scheduler because i cant even create task

Ive tried everything and it just wont create a task. Using window 7

larrikan commented 6 years ago

I also had this on a Win10 computer. Two things seem to cause the problem - using a past date/time when scheduling daily tasks, e.g. current time, by changing this to tomorrow or a later time, plus, signing in as administrator on the workstation, using the administrator username. I tried with a user in the admin group and still go the message. Try these ideas and see if you can narrow down the problem any further.

monkey8113 commented 6 years ago

It worked, i followed your advise and create a new user in admin group and used its credential for the task scheduler. This is weird, the default admin credential dont work while when using a user with admin group it worked. what could have caused this? why cant it be done with default admin credential?

p/s, after discovering the problem lies with the credential. i tried adding the system admin account in local policy to logon as a batch job. in my case my system admin account is server-pc so logon credential would be server-pc\server-pc as im not in a domain. <this worked. which confused me when i used the user in admin group the logon dont require server-pc\admin to work. only "admin" work fine.

larrikan commented 6 years ago

Good to hear you got somewhere. I think these problems relate to the account that task scheduler is using to run the jobs. It all works in command line using wakeonlanc but doesn't work on the scheduler. You can look at the task scheduler job history (the return codes) and watch the event log (the one in wakeonlan) when running the jobs. I was banging my head for while with this, different computers using different wakeonlan capabilities (S1, S2, S4) so some start from hibernate only, while others from sleep only, and then some that wakeup from a full shutdown. There are a few variables, but the event viewer in the wakeonlan, the commandline option for wakeonlanc and the task scheduler history seem to provide quite a lot of info to see where the chain is brokem. Also the WakeOnLan listener is handy. It would be really good if the listener also showed shutdown commands received as well. Anyway, great app, a bit tricky working between the app scheduler and task scheduler, but it seems to work if you are persistent.