Solved

Run a Scheduled Task as a service?

Posted on 2004-10-05
9
1,793 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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 500 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

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…
A look at what happened in the Verizon cloud breach.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

626 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