Solved

Run a Scheduled Task as a service?

Posted on 2004-10-05
9
1,755 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
Comment Utility
I.e. Can I create a scheduled task to run as a service?
0
 
LVL 15

Expert Comment

by:Yan_west
Comment Utility
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
Comment Utility
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
 
LVL 15

Expert Comment

by:Yan_west
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 23

Expert Comment

by:DanCh99
Comment Utility
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 82

Expert Comment

by:oBdA
Comment Utility
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 500 total points
Comment Utility
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:DanCh99
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Windows 8 in a W2K Domain 7 578
Update a root certificate 8 621
How to Test Com Ports on NT 4.0 Workstation 2 266
no logon server available 8 154
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…
HOW TO: Upload an ISO image to a VMware datastore for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere Host Client, and checking its MD5 checksum signature is correct.  It's a good idea to compare checksums, because many installat…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now