369

When installing Windows services there are two options for automatically starting a Windows service on Windows startup. One is Automatic, and the other is Automatic (Delayed start). What is the difference between these two in detail?

For example, if you're creating the installer with wixtoolset, the ServiceConfig element has the DelayedAutoStart attribute. How will that effect what happens when services are started at boot time?

WiX documentation: ServiceConfig Element

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Sachin Kainth
  • 41,237
  • 78
  • 185
  • 289
  • 6
    http://blogs.technet.com/b/askperf/archive/2008/02/02/ws2008-startup-processes-and-delayed-automatic-start.aspx – Adriano Repetti Jun 13 '12 at 12:53
  • 24
    I'm not sure how this is considered off topic considering the fact that http://wixtoolset.org/ gives you the ability to specify this and we allow questions about Wix. – Aelphaeis Jun 05 '14 at 13:11
  • 2
    I believe this should be migrated to superuser instead of being closed as off topic. I see there are duplicates of this in superuser as well – slayernoah Aug 21 '14 at 15:09
  • 11
    I got here looking for an answer for wix installer. This is absolutely on topic for programming as an installer is kinda relevant to programming. – Still.Tony Jan 15 '15 at 14:05
  • 6
    Agreed with Smithers and PitLock. If you look at the vote-ups for both the question and the answers on this and other "closed" subjects, it seems that some members are more interested in the letter of the law rather than the usefulness of the post, which is the whole idea behind sites like this. Apparently, they don't realize that this particular question does, in fact, affect "programming". At least they didn't take the post down. – Jeff Moden Oct 08 '15 at 20:39
  • 7
    I don't agree that this is off topic. This is very relevant to developers. – mghaoui May 10 '16 at 08:02
  • 3
    Rather than complain (however valid) please vote to reopen If you can. This is a good question. – Bill K Aug 24 '16 at 20:14

1 Answers1

508

In short, services set to Automatic will start during the boot process, while services set to start as Delayed will start shortly after boot.

Starting your service Delayed improves the boot performance of your server and has security benefits which are outlined in the article Adriano linked to in the comments.

Update: "shortly after boot" is actually 2 minutes after the last "automatic" service has started, by default. This can be configured by a registry key, according to Windows Internals and other sources (3,4).

The registry keys of interest (At least in some versions of windows) are:

  • HKLM\SYSTEM\CurrentControlSet\services\<service name>\DelayedAutostart will have the value 1 if delayed, 0 if not.
  • HKLM\SYSTEM\CurrentControlSet\services\AutoStartDelay or HKLM\SYSTEM\CurrentControlSet\Control\AutoStartDelay (on Windows 10): decimal number of seconds to wait, may need to create this one. Applies globally to all Delayed services.
pchiquet
  • 2,847
  • 1
  • 10
  • 14
Colin Pickard
  • 43,301
  • 13
  • 91
  • 143
  • 11
    I'm wondering, how short is shortly? Not much information out there. It somehow looks like Windows would wait, until the system load drops, or a certain step during the boot sequence has been reached. After that it begins starting any delayed services. Any oppionions or even knowledge on that? – leo May 27 '13 at 19:31
  • 10
    @leo 2 mins after the last automatic service - answer updated. – Colin Pickard May 27 '13 at 20:20
  • 7
    With multiple delayed start services, how does windows decide which to start first? – Ernest May 31 '13 at 14:56
  • 4
    @ErnestSoeralaya services can be marked as dependent on other services. Windows will ensure the dependencies are started first, then after that the services *should* start in alphabetical order; but this is not guaranteed. – Colin Pickard May 31 '13 at 15:47
  • 2
    I wonder what happens if one of the "automatic" service was not started correctly (failed to start) to my service if I marked it as "automatic (delayed start)" – meakgoz Aug 29 '13 at 09:04
  • 5
    @MeM A failure in any one service will not affect any other service. The only exception to this are services which are marked as dependent on other services. – Colin Pickard Aug 29 '13 at 09:49
  • Adding the registry hack to your answer would be nice. – Davor Josipovic May 13 '15 at 20:20
  • 4
    According to Tom Wijsman on superuser.com the default delay of 120 seconds can be overridden by the `AutoStartDelay` value in `HKLM\SYSTEM\CurrentControlSet\Control`. I haven't checked it. – mgr326639 Oct 16 '15 at 15:02
  • 1
    So each service is started serially, one by one, or will it actually do multiple concurrent "starts" at a time? ie, if you have multiple cores (which most people do these days)... – Adam Plocher Jun 25 '17 at 17:41
  • It would be nice to be able to stagger the startup or configure these little details. I'd hate to be booted for 2 minutes just to have my machine come to a crawl for a minute while it starts everything marked as "DELAYED". Like a Third-Party Windows Service that handles startup of over Services... hmmm – Adam Plocher Jun 25 '17 at 17:43
  • According to the references 3 and 4 in this same answer, the last key should have been `Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control` – Martin Argerami Jan 05 '18 at 17:24