Skip to content

Instantly share code, notes, and snippets.

@Andrey2G
Created March 15, 2017 20:19
Show Gist options
  • Save Andrey2G/fd171596e894ad4162b79e3bd94d1d8d to your computer and use it in GitHub Desktop.
Save Andrey2G/fd171596e894ad4162b79e3bd94d1d8d to your computer and use it in GitHub Desktop.
Powershell: Services: support Automatic (Delayed Start)
#https://msdn.microsoft.com/powershell/reference/5.1/microsoft.powershell.management/Set-Service
#There is no option Delayed autostart in StartupType
#possible solutions:
#1. start sc
$Service="My service"
sc.exe Config $Service Start= Delayed-Auto
#2. set corresponded property in regedit
#see https://blogs.technet.microsoft.com/askperf/2008/02/02/ws2008-startup-processes-and-delayed-automatic-start/
Set-ItemProperty -Path "Registry::HKLM\System\CurrentControlSet\Services\$Service" -Name "DelayedAutostart" -Value 1 -Type DWORD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment