Windows service startup type automatic

Windows Time service doesn’t start automatically on a workgroup computer

This article provides workarounds for an issue where the Windows Time service doesn’t automatically start in a stand-alone environment.

Original product version: В Windows 7 Service Pack 1, Windows Server 2012 R2
Original KB number: В 2385818

Symptoms

On a workgroup computer that’s running Windows 7, Windows Server 2008 R2, or a later version, the Windows Time service stops immediately after system startup. This issue occurs even after the Startup Type is changed from Manual to Automatic.

Cause

This issue occurs because the Windows Time service is configured as the Trigger-Start service, and it has been implemented as the default setting in Windows 7 and Windows Server 2008 R2.

Services and background processes have a significant effect on the performance of the system. The Trigger-Start service has been implemented in Windows 7 and Windows Service 2008 R2 to reduce the total number of auto-start services on the system. The goal is to improve the stability of the whole system, including improving performance and reducing power consumption. Under this implementation, the Service Control Manager has been enhanced to handle starting and stopping services by using specific system events.

Whether the Windows Time service starts automatically depends on one of the following conditions:

  • Whether the computer is joined to an Active Directory Domain Services (AD DS) domain environment.
  • Whether the computer is configured as a workgroup computer.

The Windows Time service on domain-joined computers starts when a trigger event occurs. On workgroup computers that aren’t joined to an AD DS domain:

  • The startup value for the Windows Time service is Manual.
  • The service status is Stopped.

You can check the Trigger-Start service settings by running the following command:

Workaround

To start the Windows Time service at system startup, use any of the following methods.

Run the sc triggerinfo w32time delete command to delete the trigger event that’s registered as the default setting and to change the Startup Type setting for the Windows Time service from Manual to Automatic:

Run the sc triggerinfo w32time start/networkon stop/networkoff command to define a trigger event that suits your environment. In this example, the command determines whether an IP address is given to a host. Then it starts or stops the service.

Change the Startup Type of the Windows Time service from Manual to Automatic (Delayed Start).

If the Startup Type of the Windows Time service is set to Automatic (Delayed Start), the Windows Time service may be started by the Time Synchronization before the Service Control Manager starts the Windows Time service task. It depends on the startup timing of the Windows operating system in question.

In this situation, the service triggers an automatic stop after the success of the Time Synchronization task. If you use Method 3, you must disable the Time Synchronization to avoid the task to start the Windows Time service task. To do so, follow these steps:

  1. Start the Task Scheduler.
  2. Under Task Scheduler Library >Microsoft >Windows >Time Synchronization, select Synchronize Time.
  3. Right-click, and then select Disabled on the shortcut menu.

Automatic vs Automatic (Delayed start) Service Startup types

The Services console ( services.msc ) in Windows lets you configure the startup type of Windows Services. As you know, you can choose one of the options from the dropdown: Automatic (Delayed Start), Automatic, Manual, or Disabled.

Читайте также:  Система архивации данных windows server 2012 настройка

But, do you know what’s the difference between Automatic and Automatic (Delayed Start).

Automatic vs Automatic (Delayed start) Startup types

If a service startup is set to Automatic, it loads during boot. As there are too many built-in Windows services, Microsoft first introduced the “delayed start” concept in Windows Vista to improve the Windows boot and login performance. Automatic (delayed start) services won’t start until after all other auto-start services.

The service control manager, after processing the auto-start (“Automatic”) services, it then proceeds to launch services that are set to run as Automatic (delayed start) by invoking the ScInitDelayStart() function.

After all the automatic start services are loaded, the system queues the “delay start” services for 2 minutes (120 seconds) by default. This interval can be altered by creating a registry DWORD (32-bit) value named AutoStartDelay and setting the delay (base: decimal) in seconds, in the following registry key:

Other than this, the Service Control Manager loads the “delay start” services in the same way as it starts the non-delayed auto-start services. There are no other differences between Automatic (delayed start) and Automatic startup types.

Delayed Automatic Start for System Services. To address the problem of the growing number of services set to start automatically and the subsequent negative impact on boot performance, there is a new start type for services that do not need to start early in the boot process – the Delayed start. This allows a service to still start automatically, but with the added advantage that boot performance is improved. Services set to start as Delayed will start shortly after boot.

So how does this work? The Service Control Manager starts services that are configured for the delayed automatic start after all of the automatic-start threads have finished starting. The Service Control manager also sets the priority of the initial thread for these delayed services to THREAD_PRIORITY_LOWEST. This causes all of the disk I/O performed by the thread to be a very low priority. Once a service finishes initializing, the priority is set back to normal by the Service Control Manager. The combination of the delayed start, low CPU and memory priority, as well as the background disk priority greatly reduce the interference with the user’s logon.

Many Windows services, including the Background Intelligent Transfer Service (BITS), Windows Update Client, and Windows Media Center, use this new start type to help improve logon performance after a system boot. To configure a service for delayed automatic-start, you can create a REG_DWORD value called DelayedAutoStart in the service’s configuration registry key under HKLM\SYSTEM\CurrentControlSet\Services

Registry values for Automatic and Automatic (delayed start) Startup types

For example, the Delivery Optimization service ( DoSvc ) is set to Automatic (delayed start) in Windows 10 v1903. Here are the registry values for this service which store the service startup type choice:

The DelayedAutostart value data of 1 means the service is set to delayed start. If the value is missing or is set to 0 , then it’s not set to delayed start.

For the Start DWORD value, the possible data are:

  • 2 is Automatic
  • 3 is Manual
  • 4 is Disabled
  • If the Start DWORD is set to anything other than 2 (Automatic), then the DelayedAutoStart value is ignored, even if it’s set to 1 .
  • If the Start DWORD is set to 2 (Automatic) and DelayedAutoStart is set to 0 or the value is missing, then it means the service is set to Automatic start (no delay.)

Editor’s note: Arbitrarily changing the service startup types can cause problems to the system. It’s advisable to leave the services configuration in the Windows default setting in most cases. If you plan to modify the services configuration, backup the current service startup configuration, create a Restore Point, or perform a complete registry backup beforehand.

Startup Type property in the DHCP Client service is changed to Automatic in Windows 7 or in Windows Server 2008 R2

Symptoms

Consider the following scenario:

Читайте также:  Как открыть системные значки windows

You set the Startup Type property in the Dynamic Host Configuration Protocol (DHCP) Client service to Disabled on a computer that is running Windows 7 or Windows Server 2008 R2.

You install the following updates on the computer:

Service Pack 1 (SP1) for Windows 7 or for Windows Server 2008 R2

You restart the computer.

In this situation, the Startup Type property in the DHCP Client service is set to Automatic.

Cause

This issue occurs because an error in the Nettcpip.inf file causes the settings in the DHCP Client service to revert to the default settings.

Resolution

Hotfix information

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing the problem described in this article. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

If the hotfix is available for download, there is a «Hotfix download available» section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website:

http://support.microsoft.com/contactus/?ws=supportNote The «Hotfix download available» form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Prerequisites

To apply this hotfix, you must be running one of the following operating systems:

Windows 7 Service Pack 1 (SP1)

Windows Server 2008 R2

Windows Server 2008 R2 Service Pack 1 (SP1)

For more information about how to obtain a Windows 7 or Windows Server 2008 R2 service pack, click the following article number to view the article in the Microsoft Knowledge Base:

976932 Information about Service Pack 1 for Windows 7 and for Windows Server 2008 R2

Registry information

To apply the hotfix in this package, you do not have to make any changes to the registry.

Restart requirement

You do not have to restart the computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File information

The global version of this hotfix installs files that have the attributes that are listed in the following tables. The dates and the times for these files are listed in Coordinated Universal Time (UTC). The dates and the times for these files on your local computer are displayed in your local time together with your current daylight saving time (DST) bias. Additionally, the dates and the times may change when you perform certain operations on the files.

Windows 7 and Windows Server 2008 R2 file information notes

The files that apply to a specific product, milestone (RTM, SP n), and service branch (LDR, GDR) can be identified by examining the file version numbers as shown in the following table:

“Automatic” vs “Automatic (Delayed start)”

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?

1 Answer 1

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

Читайте также:  Windows завершает работу проводника

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\ \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.

question

change service startup type

i have windows servers and i have the below service on those servers whose startup type is automatic, how can i change the startup type to Automatic Delayed Start using configuration manager or is it possible to do with any PowerShell script. Please guide me on this

Path to Executable:
«C:\Program Files\Software\Folder1\app.exe» service

6 Answers

The «AutomaticDelayedStart» value is only available with PowerShell 6 and above.
You’d need to leverage the registry value for now

I’d suggest using the «Run Scripts» Feature as Youseff said, and using a script like this:

[CmdletBinding()]
Param (
[Parameter(Mandatory=$true,Position=1,HelpMessage=»Service Name»)]
[ValidateNotNullOrEmpty()]
$ServiceName
)

if (Test-Path -Path «HKLM:\SYSTEM\CurrentControlSet\Services\$ServiceName»)
<
Set-ItemProperty -Path «HKLM:\SYSTEM\CurrentControlSet\Services\$ServiceName» -Name ‘Start’ -Value ‘1’ -Force
write-output «Value for $($ServiceName): $(Get-ItemPropertyValue -Path «HKLM:\SYSTEM\CurrentControlSet\Services\$ServiceName» -Name ‘Start’)»
>
else
<
Write-Output «NO Service $ServiceName On this machine»
>

i am trying the below script. i have my servers in text file. i am getting the below error please correct me with the script

$SL = «C:\list.txt»
$SS = get-Content -Path $SL
foreach ($Servers in $SS ) <
Invoke-Command -ComputerName $Servers -ScriptBlock <
sc.exe config MyServiceName start= delayed-auto
>
>

[server01] Connecting to remote server server01 failed with the following error message : The client cannot connect
to the destination specified in the request. Verify that the service on the destination is running and is accepting
requests.
+ CategoryInfo : OpenError: (server01:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : CannotConnect,PSSessionStateBroken

Will the below script work for me

Powershell
$SL = «C:\list.txt»
$SS = get-Content -Path $SL
foreach ($Servers in $SS ) <
Invoke-Command -ComputerName $Servers -ScriptBlock <
Set-itemproperty -name Start -path «HKLM:\System\CurrentControlSet\Services\MyService» -value «1»
>
>

You can create a Powershell script on ConfigMgr with the following command and run it on the target device collection:

Set-Service -Name «Service name» -StartupType AutomaticDelayedStart

Refer to the following guide:

Please remember to “Accept answer” for useful answers, thank you!

Before trying from configMgr i have tried to execute the below command on one server from PowerShell I am getting the below error.

Set-Service -Name MyService -StartupType AutomaticDelayedStart

Set-Service : Cannot bind parameter ‘StartupType’. Cannot convert value «AutomaticDelayedStart» to type
«System.ServiceProcess.ServiceStartMode». Error: «Unable to match the identifier name AutomaticDelayedStart to a valid
enumerator name. Specify one of the following enumerator names and try again: Boot, System, Automatic, Manual,
Disabled»
At line:1 char:48
+ Set-Service -Name MyService -StartupType AutomaticDelayedStart
+

+ CategoryInfo : InvalidArgument: (:) [Set-Service], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.SetServiceCommand

The «AutomaticDelayedStart» value is only available with PowerShell 6 and above.
You’d need to leverage the registry value for now

I’d suggest using the «Run Scripts» Feature as Youseff said, and using a script like this:

[CmdletBinding()]
Param (
[Parameter(Mandatory=$true,Position=1,HelpMessage=»Service Name»)]
[ValidateNotNullOrEmpty()]
$ServiceName
)

if (Test-Path -Path «HKLM:\SYSTEM\CurrentControlSet\Services\$ServiceName»)
<
Set-ItemProperty -Path «HKLM:\SYSTEM\CurrentControlSet\Services\$ServiceName» -Name ‘Start’ -Value ‘1’ -Force
write-output «Value for $($ServiceName): $(Get-ItemPropertyValue -Path «HKLM:\SYSTEM\CurrentControlSet\Services\$ServiceName» -Name ‘Start’)»
>
else
<
Write-Output «NO Service $ServiceName On this machine»
>

Below information is displayed from services. MSc
ServiceName: MyAPP
Display Name: MyAPP Service
Path to executable: «C:\Program Files\Software\Folder1\app.exe» service

Registry: HKLM:\SYSTEM\CurrentControlSet\Services\MyAPP
DisplyName: MyAPP Service

will the below script work for me

[CmdletBinding()]
Param (
[Parameter(Mandatory=$true,Position=1,HelpMessage=»Service Name»)]
[ValidateNotNullOrEmpty()]
$ServiceName = MyAPP
)

if (Test-Path -Path «HKLM:\SYSTEM\CurrentControlSet\Services\$ServiceName»)
<
Set-ItemProperty -Path «HKLM:\SYSTEM\CurrentControlSet\Services\$ServiceName» -Name ‘Start’ -Value ‘1’ -Force
write-output «Value for $($ServiceName): $(Get-ItemPropertyValue -Path «HKLM:\SYSTEM\CurrentControlSet\Services\$ServiceName» -Name ‘Start’)»
>
else
<
Write-Output «NO Service $ServiceName On this machine»
>

Оцените статью