Re: Using group policy to schedule tasks

  • Thread starter Thread starter Ullattil Shaji[MSFT]
  • Start date Start date
U

Ullattil Shaji[MSFT]

Hi,
Running it as a user logon script (logon script runs as the user) might
not always work because a non administrator user might not be able to reboot
the machine.

If you know when the machine boots up, when you want it to be shutdown, you
can probably run it as a startup script. Will that work?

HTH,
-Shaji.
 
A better option than the at command especially if you are working with xp and server 2000/2003 is the schtask command.

I have the 800 odd computers at the school I work at executing a system shutdown at 6pm, well we are supposedly an eco school after all and people were leaving computers on overnight and over weekends even holiday periods.
So I created 2 batch files stored on the server and deliver one as a startup script this creates a scheduled task using schtask. Because I use the network administrator account to create it no-one can interfere with it or overrride it when it kicks in. This task then calls the 2nd batch file, which executes the shutdown command with a 5 minute countdown and will shut the machine off at exactly 6pm. There is nothing to prevent a user turning the machine back on again after 6pm it's just at 5:55pm the scheduled task executes the 2nd batch file which after the 5 minute countdown the puts the computer off.
It has also improved our policy changes as each machine is guaranteed to be off in the morning as (at least for the majority of the school's computers) they are unattended at 6pm.
Because I used schtask instead of at it only creates the one job on each startup and because I scheduled it as a 'run once' setting, the task if it gets executed is automatically removed from the scheduled task list.
I can send you the script files if you want to send me an e-mail address but it really does work effectively as a couple of times nowI have been there after 6pm and seen with my own eyes entire computer suites shut themselves down, it's really something to see!

Mavericks Ghost
 
I would also like to see how the batch file method works. I have tried it myself by normal users don't seem to be able to create tasks with schtasks that run as higher level users (such as required to shutdown a pc)

thanks
 
Nope... I think its just BS because I've tried all this before with no success. I was thinking this guy had the magic solution but apparently not.
 
Hi mavericks_ghost,

Do you think is possible to send me instructions how to schedule a bat file to run in GPO?
Please e-mail me. Thank you.



QUOTE=mavericks_ghost]A better option than the at command especially if you are working with xp and server 2000/2003 is the schtask command.

I have the 800 odd computers at the school I work at executing a system shutdown at 6pm, well we are supposedly an eco school after all and people were leaving computers on overnight and over weekends even holiday periods.
So I created 2 batch files stored on the server and deliver one as a startup script this creates a scheduled task using schtask. Because I use the network administrator account to create it no-one can interfere with it or overrride it when it kicks in. This task then calls the 2nd batch file, which executes the shutdown command with a 5 minute countdown and will shut the machine off at exactly 6pm. There is nothing to prevent a user turning the machine back on again after 6pm it's just at 5:55pm the scheduled task executes the 2nd batch file which after the 5 minute countdown the puts the computer off.
It has also improved our policy changes as each machine is guaranteed to be off in the morning as (at least for the majority of the school's computers) they are unattended at 6pm.
Because I used schtask instead of at it only creates the one job on each startup and because I scheduled it as a 'run once' setting, the task if it gets executed is automatically removed from the scheduled task list.
I can send you the script files if you want to send me an e-mail address but it really does work effectively as a couple of times nowI have been there after 6pm and seen with my own eyes entire computer suites shut themselves down, it's really something to see!

Mavericks Ghost[/QUOTE]
 
Is this a correct schedule bat script ?:
schtasks /create /RU SYSTEM /SC WEEKLY /TN PCTest /TR "C:\Temp\PCCleanup.bat" -v -tD /ST 23:30:00 /SD 06/09/2010
 
Back
Top