Windows: Remove a trigger from a service
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 each time.
The Workarounds by setting
- Enable the firewall rule “Network Discovery (LLMNR-UDP-In)”, which means that Port UDP/5355 is not blocked
- And setting the DNS Client IdleTimeOut to 0xffffffff
Windows Registry Editor Version 5.00
had no effect.
I choose a pragmatic approach. To prevent the DNS Client (dnscache) from starting and stopping I removed the trigger from the service by the sc.exe command:
Query all triggers
C:\>sc qtriggerinfo dnscache [SC] QueryServiceConfig2 SUCCESS SERVICE_NAME: dnscache START SERVICE FIREWALL PORT EVENT : b7569e07-8421-4ee0-ad10-86915afdad09 [PORT OPEN] DATA : 5355;UDP;
Remove the trigger
C:\>sc triggerinfo dnscache delete [SC] ChangeServiceConfig2 SUCCESS
To restore the default behaviour use
C:\> sc triggerinfo dnscache start/portopen/5355;UDP [SC] ChangeServiceConfig2 SUCCESS