Skip to main content
Skip table of contents

154. Automating the nightly restart of an EzeScan service

Stopping/Starting Windows Services

You should be familiar with using the Windows Services App to control Windows services.

First Launch the windows Services App.

Select a service and then right mouse button click to display this menu.

Simply choose ‘Start’ to start a service that is not currently running, or choose ‘Stop’ to stop a running service.

But how can we set one of the windows services to restart everyday at 12.01am?

The Windows Services App alone doesn’t support that functionality.

You will need to use another windows feature to do that. It’s called the Task Scheduler.

Here’s How To Restart A Windows Service Using Task Scheduler

You may wish to restart Windows Services on a regular basis. This allows windows to recycle processes and memory threads to keep a healthy system running.

To recycle Windows Services you can simply create Scheduled Tasks using two actions with the NET commands. The first one to stop the service, the second one to start the service.

The examples below shows how to do this for an instance of EzeScan Server that is running as a service. It shows how to use 2 scheduled tasks., one to stop the service at 12.01 am and another to restart it at 12.03 am.

If you really want to test this properly you might want to set your initial settings for the actual stop and start times to something like 30 minutes in the future, so you can easily see whether the scheduled tasks work.

Once you know they work, you could them edit them and put the real 12.01am stop time and 12.03 start time values back into the scheduled tasks.

And of course if you want to restart your service at a completely different time, just use start and stop time values that suit your needs.

Configuring A Scheduled Task To Stop An EzeScan Service

Instructions 

  1. Open the Windows Services Management Console by typing services.msc in the run box.

  2. Locate the EzeScan Server service and open its properties.

  3. Take note of the Service name for future use (i.e. Ezescan Server)

  4. Open the Task Scheduler by typing Task in the Windows search box:

  5. Select Create a Basic Task from the Actions list on the right:

  6. Name the task Stop EzeScan Server Service

  7. Click Next and select Daily Trigger:

  8. Pick a time where there will be no activity such as 12.01 AM:

  9. Click Next and for the Action select Start a program:

  10. For the Program/Script type NET and add the arguments Stop "EzeScan Server" or service name noted earlier (step #3) if different:

  11. You are now at the Finish screen. Don’t press Finish yet!

  12. Before Finishing, select the Open the Properties dialog option:

  13. Now press Finish

  14. In the General tab select Run whether user is logged in or not and Run with highest privileges:

Enter your login credentials when prompted

15. Congratulations you have just created a scheduled task that will run at 12.01 am every day that will stop a running EzeScan Server service.

Configuring A Scheduled Task To Start An EzeScan Service

We will start the EzeScan Server service 2 minutes later to give the Windows Service some time to close all pending tasks before restarting.

Instructions 

  1. Open the Windows Services Management Console by typing services.msc in the run box.

  2. Locate the EzeScan Server service and open its properties.

  3. Take note of the Service name for future use (i.e. Ezescan Server)

  4. Open the Task Scheduler by typing Task in the Windows search box:

  5. Select Create a Basic Task from the Actions list on the right:

  6. Name the task Start EzeScan Server Service

  7. Click Next and select Daily Trigger:

  8. Pick a time where there will be no activity such as 12.01 AM:

  9. Click Next and for the Action select Start a program:

  10. For the Program/Script type NET and add the arguments Start "EzeScan Server" or service name noted earlier (step #3) if different:

  11. You are now at the Finish screen. Don’t press Finish yet!

  12. Before Finishing, select the Open the Properties dialog option:

  13. Press Finish

  14. In the General tab select Run whether user is logged in or not and Run with highest privileges:

    Enter your login credentials when prompted

15. Congratulations you have just created a scheduled task that will run at 12.03 am every day that will restart a stopped EzeScan Server service.

More Info

NET START can be used to start Windows services. NET STOP can be used to stop Windows services.

When typed at the command prompt, service names of two words or more must be enclosed in quotation marks. For example, NET START "EzeScan Server" starts the EzeScan Server service.

You can use this technique with any Windows Service responding to the NET command.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.