You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Service exists, proceed with changing properties -- while handling auto delayed start for PWSH 5
28
+
if (($PSVersionTable.PSVersion.Major-lt7) -and ($StartupType-eq"AutomaticDelayedStart")) {
29
+
# Auto delayed start doesn't work with PWSH 5. That startup type is a combination of both the Automatic startup type,
30
+
# and an additional DWORD value for delayed start. That's how the SCM defines it. For this, we'll go with sc
31
+
#
32
+
# PWSH 5 uses a built-in enum for service start types: System.ServiceProcess.ServiceStartMode (https://learn.microsoft.com/en-us/dotnet/api/system.serviceprocess.servicestartmode?view=net-10.0-pp)
33
+
# PWSH 7 uses a custom enum for service start types: Microsoft.PowerShell.Commands.ServiceStartupType (https://learn.microsoft.com/en-us/dotnet/api/microsoft.powershell.commands.servicestartuptype?view=powershellsdk-7.4.0)
34
+
#
35
+
# ---- That's why this doesn't work on the former!
0 commit comments