Windows Service Restarts Scheduling

How to schedule services on a windows server

Task: e.g. Restart a certain service once a night.

  • Can not be done out the box through task scheduler
  • Commercial products available

Do it yourself:

  • scripting
 * bat w/ psservice call from SDK
 * wbscript w/ WMI 
 * powershell

Syntax of net command:

http://technet.microsoft.com/en-us/library/cc736564(WS.10).aspx#BKMK_cmd

Suggested solution:

  • Control Windows service remotely from Unix box:
         # net rpc service [stop,start,restart] [Service] -I [Server] -U Administrator%[password]

Usage:

 net rpc service list            View configured Win32 services
 net rpc service start           Start a service
 net rpc service stop            Stop a service
 net rpc service pause           Pause a service
 net rpc service resume          Resume a paused service
 net rpc service status          View current status of a service
 net rpc service delete          Delete a service
 net rpc service create          Create a service