question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set-Service <name> -StartupType AutomaticDelayedStart sets startup to Automatic

See original GitHub issue

Prerequisites

Steps to reproduce

In PowerShell 7.1.5, with admin right, calling Set-Service <name> -StartupType AutomaticDelayedStart does not result in the service getting a change in the startup type.

Expected behavior

When I visually inspect the service in the Services window, I expected to see the Startup Type listed as "Automatic (Delayed Startup)"

Actual behavior

When I visually inspect the service in the Services window, I see the Startup Type listed as "Automatic"

Error details

No errors returned

Environment data

Name                           Value
----                           -----
PSVersion                      7.1.5
PSEdition                      Core
GitCommitId                    7.1.5
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:21

github_iconTop GitHub Comments

1reaction
LarsFosdalcommented, Nov 8, 2021

Yes, the executing account has local admin rights and the script runs elevated, and the service is set up to log on as that account.

Can you verify that -StartupType Automatic and AutomaticDelayedStart gives different results in the Services window list? For me, it appears that both set it to just Automatic.

0reactions
msftbot[bot]commented, Feb 3, 2023

This issue has been marked as answered and has not had any activity for 1 day. It has been closed for housekeeping purposes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set service StartType to Automatic - Delayed
Using Set-Service , I'm able to change the StartType of my services between the accepted values of Boot, System, Automatic, Manual, Disabled ....
Read more >
change service startup type - Microsoft Q&A
Set-Service -Name "Service name" -StartupType AutomaticDelayedStart. Refer to the following guide: Create and run PowerShell scripts from the ...
Read more >
Set-Service (Microsoft.PowerShell.Management)
The StartupType parameter sets the service to Automatic. Get-Service uses the Name parameter to specify the BITS service and sends the object down...
Read more >
Set service startup mode to Automatic (Delayed Start) with ...
Automatic (Delayed Start ) is a new service startup mode that is available from Windows Vista onward. This startup type allows you to...
Read more >
Set-Service and AutomaticDelayedStart option : r/PowerShell
I am trying to do something like this: Get-Service -Name MSSQLSERVER | Set-Service -StartupType AutomaticDelayedStart.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found