Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Run a Scheduled Task as a service?

Posted on 2004-10-05
9
Medium Priority
?
1,806 Views
Last Modified: 2008-01-09
Ok, it's a long story so I won't go into the details of why, but it must be done this way.

I need to force 60 W2K domain workstations (2K AD) to reboot at 19:00 every day. I need this to happen whether the machines are logged in or not, and their time is out of synch with the DC's by about 1 year all day (user accessing some training database from Oct 03) so I can't instigate this from a server, the command has to come from the local machine.

I can create a scheduled task to run reboot.bat as below:

shutdown.exe /C /L /R

That runs fine as a scheduled task when the machine is logged in but not when the machine has been logged off and is sitting at the Ctrl, Alt & Del screen.

My question is how can I get reboot.bat to run at 19:00 every day from the local workstation to force a reboot regardless of it's log in state?
0
Comment
Question by:youre1m
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 6

Author Comment

by:youre1m
ID: 12226905
I.e. Can I create a scheduled task to run as a service?
0
 
LVL 15

Expert Comment

by:Yan_west
ID: 12226992
Use PShutdown from sysinternal, and create a batch file on one machine that shutdown all machine of your network remotly..!

http://www.sysinternals.com/ntw2k/freeware/psshutdown.shtml
0
 
LVL 6

Author Comment

by:youre1m
ID: 12227071
I can't do that, as I mentioned the system time varies from machine to machine so they can't talk to each other / servers, otherwise I would have done it. It has to run from the local machine.

Keep trying please!!
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
LVL 15

Expert Comment

by:Yan_west
ID: 12227256
Not sure if this would work..

http://www.firedaemon.com/

FireDaemon is a utility that allows you to install and run virtually any native Win32 application or script (eg. BAT/CMD, Perl, Java, Python, TCL/TK) as a Windows NT, 2000, XP, 2003 & Longhorn service. FireDaemon features easy configuration (via GUI or XML), a low memory/CPU overhead, subprocess prioritisation, custom environments, CPU binding plus monitoring and logging to the event log and on-disk log files.
0
 
LVL 23

Expert Comment

by:Danny Child
ID: 12227485
also consider psExec
http://www.sysinternals.com/ntw2k/freeware/psexec.shtml
if you want to stick with shutdown.exe

I'm confused (obviously missing something) about the effect of the differing times.  Do all the machines have their own different local clocks, and you want them all to finish at 19:00 **local** time?  Are the clocks all over the place, or are they grouped ie some in PST, some in EST, and so on?

psshutdown works for me on servers, whether logged in or not as part of my UPS managment
psshutdown.exe -t 30 -f -c @%ServList% -m "System Shutting down" 2>&1 | findstr . >>"%LogFile%"

-t = time to shutdown in sec
-f = force apps to close
-c = allows user to abort
where %ServList% is a variable, containing the full path to a text file listing all machines.
-m = message to user
and the last bit is just some funkyness to parse the results to a log file variable, stripping out any blank lines.  

I'll keep playing with the Scheduled Tasks too...


0
 
LVL 85

Expert Comment

by:oBdA
ID: 12228592
This should run as well while nobody is logged on. Create a new account for this, with the necessary permissions to reboot the machine, and use this account to run the scheduled task with.
0
 
LVL 20

Accepted Solution

by:
Debsyl99 earned 2000 total points
ID: 12229310
Hi
Or you can use AT. Just make sure that task scheduler service is running and is configured to logon as local service account - services - task scheduler-properties-log on which is general default anyway. Rename your bat file reboot.cmd, put it in say the root C: directory

at a command prompt paste this in:

AT 19:00 /EVERY:m,t,w,th,f,s,su cmd /c c:\reboot.cmd

hit return and it will reboot every day regardless of anyone logged in or not,

AT
http://www.ss64.com/nt/at.html

Deb :))


0
 
LVL 23

Expert Comment

by:Danny Child
ID: 12236401
one small thing, I'm fairly sure that the account that you run a scheduled task under CANNOT have a blank password.  just in case it's relevant!
0
 
LVL 6

Author Comment

by:youre1m
ID: 12481865
Ok, AT was thew way to go, although I had to change the system date back before applying the AT command as if I applied it using the current date and then changed the date back the AT command didn't apply, makes sense I guess but I thought with me telling it to run it every day it would not care about what date the command was applied on, for you info anyway, thanks all.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Your business may be under attack from a silent enemy that is hard to detect. It works stealthily in the shadows to access and exploit your critical business information, sensitive confidential data and intellectual property, for commercial gain. T…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question