This works for me on a random service :
Dim bRet As Boolean = ChangeServiceConfig(scTemp.ServiceHandle, CUInt(SERVICE_NO_CHANGE), SERVICE_AUTO_START,
SERVICE_NO_CHANGE, Nothing, Nothing, IntPtr.Zero, Nothing, Nothing, Nothing, Nothing)
If (bRet) Then
Dim sdasi As SERVICE_DELAYED_AUTO_START_INFO = New SERVICE_DELAYED_AUTO_START_INFO()
sdasi.fDelayedAutostart = True
Dim pSDASI As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(GetType(SERVICE_DELAYED_AUTO_START_INFO)))
Marshal.StructureToPtr(sdasi, pSDASI, False)
bRet = ChangeServiceConfig2(scTemp.ServiceHandle, SERVICE_CONFIG_DELAYED_AUTO_START_INFO, pSDASI)
Marshal.FreeHGlobal(pSDASI)
End If
with
<DllImport("Advapi32.dll", SetLastError:=True, CharSet:=CharSet.Unicode)>
Public Shared Function ChangeServiceConfig(<[In]()> ByVal hService As SafeHandle, ByVal dwServiceType As UInteger, ByVal dwStartType As UInteger, ByVal dwErrorControl As UInteger,
<[In](), MarshalAs(UnmanagedType.LPWStr)> ByVal lpBinaryPathName As String, <[In](), MarshalAs(UnmanagedType.LPWStr)> ByVal lpLoadOrderGroup As String,
ByVal lpdwTagId As IntPtr, <[In](), MarshalAs(UnmanagedType.LPWStr)> ByVal lpDependencies As String, <[In](), MarshalAs(UnmanagedType.LPWStr)> ByVal lpServiceStartName As String,
<[In](), MarshalAs(UnmanagedType.LPWStr)> ByVal lpPassword As String, <[In](), MarshalAs(UnmanagedType.LPWStr)> ByVal lpDisplayName As String) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
<DllImport("Advapi32.dll", SetLastError:=True, CharSet:=CharSet.Unicode)>
Public Shared Function ChangeServiceConfig2(hService As SafeHandle, dwInfoLevel As UInteger, lpInfo As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
Public Const SERVICE_NO_CHANGE As UInteger = &HFFFFFFFFUI
Public Const SERVICE_BOOT_START = &H0
Public Const SERVICE_SYSTEM_START = &H1
Public Const SERVICE_AUTO_START = &H2
Public Const SERVICE_DEMAND_START = &H3
Public Const SERVICE_DISABLED = &H4
Public Const SERVICE_CONFIG_DESCRIPTION = 1
Public Const SERVICE_CONFIG_FAILURE_ACTIONS = 2
Public Const SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 3
Public Const SERVICE_CONFIG_FAILURE_ACTIONS_FLAG = 4
Public Const SERVICE_CONFIG_SERVICE_SID_INFO = 5
Public Const SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO = 6
Public Const SERVICE_CONFIG_PRESHUTDOWN_INFO = 7
Public Const SERVICE_CONFIG_TRIGGER_INFO = 8
Public Const SERVICE_CONFIG_PREFERRED_NODE = 9
' reserved 10
' reserved 11
Public Const SERVICE_CONFIG_LAUNCH_PROTECTED = 12
<StructLayout(LayoutKind.Sequential)>
Public Structure SERVICE_DELAYED_AUTO_START_INFO
Public fDelayedAutostart As Boolean
End Structure