Link to home
Start Free TrialLog in
Avatar of Yann Shukor
Yann ShukorFlag for France

asked on

Delayed service start

Hi

I tried to delay the launch of two services (PRTG) because the data that this app uses is on a network drive that isn't available when the server boots up

Apparently the delayed start adds two minutes to the service start process; unfortunately this isn't enough

So I create a batch file (cmd) which is executed from the task scheduler when the system starts up
I added a five minute pause before the Net Start commands in the batch

timeout /t 300
&& net start PRTGCoreService 
&& net start PRTGProbeService  
exit

Open in new window


This unfortunately isn't working as planned

any ideas ?

thanks
yann
Avatar of Viral Rathod
Viral Rathod
Flag of India image

Set the service to Manual instead of Automatic. (right-click my computer, manage, services)

Create a new batch file and put it somewhere.

in the batch file, do this:

@echo off
cls
sleep 300
NET START SERVICENAME*

*the name of the service you want to start

Add a shortcut to the batch file to your startup (in the start menu). Adjust the time to sleep to be whatever you want.

so adding this batch file to server startup will resolve the issue.

Note : There is no need to schedule the task to start the service.
Avatar of Shaun Vermaak
Do away with batch
Create two scheduled tasks
Set first task to trigger at "Logon" and delay task for 5minutes
Set the second task to trigger at "Logon" and delay task for 6minutes

User generated image
Avatar of Yann Shukor

ASKER

Thanks for your suggestion Viral
Sleep isn't a recognized command, that is why I use Timeout

My services are already in manual startup mode

Your solution is fine if one want's to execute this batch upon opening a session

I want run the batch when the server starts, whether or not a user session is initiated, that is why I used the task scheduler
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Shaun, tried that first but windows 2012 R2 doesn't seem to take notice of the modified delay
Have you tried setting the master value in HKLM\SYSTEM\CurrentControlSet\Control\AutoStartDelay?
Shaun = yes
Tried the registry update again and this time it worked
thanks