Changing a service startup type can be crucial after installing or configuring the service.
PowerShell comes with an easy way to do so:
Windows Services are the components or applications that starts when your computer is booted up and runs in the background mode helping the application to work smoothly and finally stops when the computer shuts down. For Example, If you want to send or receive any Fax, then the Fax service should be running in the background to perform the Fax. Hi, since Windows 7 respectively Windows 2008R2 it has the ability to start a windows service with a trigger. Some Services, like dnscache, starts or stops on demand. A customer had the problem that sometimes, after an automatic restart (on idle) of the DNS Client Service, Windows won't register its name in DNS anymore. A manual register with C: ipconfig /registerdns was necessary. The SC tool (sc.exe) can be used to configure or query a service’s trigger events at the command prompt. Use the triggerinfo option to configure a service to start or stop in response to a trigger event. Use the qtriggerinfo option to query the trigger configuration of a service. Numerical value to indicate if the service startup type has: 0 - no startup triggers 1 - has startup triggers This macro is supported since Zabbix 3.4.4. It is useful to discover such service startup types as Automatic (trigger start), Automatic delayed (trigger start) and Manual (trigger start).
Set-Service –Name theservice –Computer thecomputer –StartupType “selectedType”
Where selectedType value can be:
- Automatic
- Manual
- Disabled
Unfortunately, there is no support for the automatic (delayed start). To support the automatic (delayed start), you need to create a REG_DWORD value called DelayedAutoStart under HKLMSystemCurrentControlSetServices. A simple way to do so would be:
Set-ItemProperty -Path 'Registry::HKLMSystemCurrentControlSetServicestheservice' -Name 'DelayedAutostart' -Value 1 -Type DWORD
Related
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 of Windows, 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 this 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 in order to reduce the total number of auto-start services on the system. The goal is to improve the stability of the whole system, and this includes 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.
For more information, see Service trigger events.
Whether or not the Windows Time service starts automatically depends on whether the computer is joined to an Active Directory Domain Services (AD DS) domain environment or is configured as a workgroup computer. The Windows Time service on domain-joined computers starts when a trigger event occurs. On workgroup computers that are not joined to an AD DS domain, the startup value for the Windows Time service is Manual, and the service status is Stopped.
You can check the Trigger-Start service settings by running the following sc qtriggerinfo
command:
Workaround
To start the Windows Time service at system startup, use any of the following methods.
Method 1
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:Method 2
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, and then it starts or stops the service.Method 3
Change the Startup Type of the Windows Time service from Manual to Automatic (Delayed Start).
Note
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. (This 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. Therefore, if you use Method 3, you must disable the Time Synchronization to avoid the task to start the Windows Time service task. To do this, follow these steps:
- Start the Task Scheduler.
- Under Task Scheduler Library > Microsoft > Windows > Time Synchronization, click Synchronize Time.
- Right-click, and then click Disabled on the shortcut menu.
More information
Windows Services Manual Trigger Start Ever Foundry -
The Windows Time service on a workgroup computer is not started automatically at system startup by the Trigger-Start service. However, the Windows Time service is started by the Time Synchronization setting that's registered on the Task Scheduler Library at 01:00 a.m. every Sunday for Time Synchronization. Therefore, the default setting can be kept as it is.