3
I need to run a command every night at 11pm on a Windows machine. In order to keep things simple, I'd like to automate the insertion of this command into Windows' event scheduler. I'm looking to do something like this:
insertCommandIntoTaskScheduler.exe --at "11:00pm every night" "shutdown.exe -s -f"
Is this possible, or do I have to use the UI?
Weirdest thing happened. 1. This task requires the account owner to be an administrator and 2. this task requires the account owner to have a password, otherwise it will not work. Also, with the above conditions met, this worked on my VirtualBox XP instance here, but a friend's XP machine didn't have schtasks installed for some weird reason. Any ideas? – Naftuli Kay – 2011-09-06T00:04:29.183
The tool might be specific to XP Pro? Also, are you talking about the tool or the shutdown command when you say Admin rights are required? (Not sure about the former, but can fix the latter.) about the former, but can fix the latter.) – user1686 – 2011-09-06T04:02:13.207
I guess the
schtasks
tool must be an XP Pro thing. Weird. Also, the task itself won't run unless the user is an administrator with a password. (Hopefully it's fixable, then ;]) – Naftuli Kay – 2011-09-06T04:18:15.627The
shutdown
tool requires SeRemoteShutdownPrivilege, even for local usage, since it uses remote RPCs. You can grant it to users viasecpol.msc
(Allow to remotely shut down the machine blah blah) -- but it's a somewhat insecure way. Granting it to INTERACTIVE and BATCH special groups would be the best way. Not sure if the password requirement can be securely avoided. – user1686 – 2011-09-06T04:24:21.017I'm somewhat new to Windows permissions (as I'm coming from Unix/Linux, and it's a lot more straightforward there). Since this should probably be covered in another question, what should I ask so I can get the right answer? ;) – Naftuli Kay – 2011-09-06T15:19:14.897
"How can I allow non-Administrators to use
shutdown.exe
" would be a good start. – user1686 – 2011-09-06T17:06:04.797Done: http://superuser.com/q/332548/55611
– Naftuli Kay – 2011-09-06T17:20:13.623