Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been trying to get Server 2008 R2 to reboot after everyone is gone from work, to get its updates installed, but what I've been trying apparently isn't working.

I have a "reboot.bat" in C:/ that contains:

shutdown –r –f –t 5

The task is scheduled for 11:00PM, but when I come in the next day, it says "Last Run Result: (0x1)." and the server hasn't restarted.

Is there a better way to do this? Hopefully one that works...?

share|improve this question
1  
Yup - aside from anything else, you've got your syntax wrong, as cheekaleak shows you below. Slashes, not dashes - mostly standard for Windows executables. –  mfinni Jun 22 '12 at 18:02
1  
It makes sense to try running a batch file from the command line to make sure it works before scheduling it and keeping your fingers crossed it runs as scheduled. –  dimitri.p Jun 22 '12 at 20:43
add comment

1 Answer

up vote 4 down vote accepted

yes, set your scheduled task to run whether user is logged on or not and is set to run with highest privledges. For the Actions section, set the action to "start a program" with C:\Windows\System32\shutdown.exe and then /r /f /t 5 as the arguments.

Make sure the account credentials used for the task have Log on as Batch Job rights.

share|improve this answer
    
I already have "Run whether user is logged in or not" and "Run with highest privileges" set. I'll try the shutdown.exe instead of my reboot.bat though. I'm running it as the Domain Admin, so I assume it has the Batch Job rights? –  David Jun 22 '12 at 17:53
    
That would be dependent on how your policies are setup, so you may not. If you open an elevated command prompt and run "rsop" drill down to: Computer Configuration> Policies> Windows Settings> Security Settings> Local Policies> User Rights Assignment; and check if the Domain Admin group is listed under "Log on as batch job". –  Cheekaleak Jun 22 '12 at 18:00
    
That is it, thanks. Hopefully I won't have to report back come Monday! –  David Jun 22 '12 at 18:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.