Skip navigation

JSI Tip 0086 - How do I schedule a service (such as RAS) to start and stop?

You can use the AT command (or a good scheduler such as OpalisRobot) to schedule a batch file that contains a net start and/or net stop.

Here is an example of scheduling RAS to stop at 23:00 and start up at 04:00

AT \\ServerName 23:00 /interactive /every:M,T,W,Th,F,S,Su cmd.exe /c "Drive:\Directory\RASSS.bat"

where RASSS contains:

net stop RemoteAccess
sleep 18000
net start RemoteAccess
Exit

Note 1: RemoteAccess is the actual service name. To determine the service name, scan the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\

Note 2: Sleep is a Resource Kit utility. If you don't have it and can't afford it, schedule the net start as a separate job.


Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish