Hi
This is related to this Thread a bit
https://eileenslounge.com/viewtopic.php ... 53#p291953
I am using ____ coding in PowerShell to set a service. The service has 4 start up type options
Automatic (Delayed Start)
Automatic
Manual
Disabled
I can get three of them using any amount of the appropriate word in upper or lower case.
For example in PowerShell with administrator rights, all these do what I want
Set-Service "dmwappushservice" -StartupType Disabled # sets Disabled( or Deaktiviert )
Set-Service "dmwappushservice" -StartupType dis # sets Disabled( or Deaktiviert )
Set-Service "dmwappushservice" -StartupType man # sets Manual( or Manuell )
Set-Service "dmwappushservice" -StartupType Auto # sets Automatic( or Automatisch )
Set-Service "dmwappushservice" -StartupType au # sets Automatic( or Automatisch )
Etc.
But I can’t yet get the syntax for Automatic (Delayed Start)
Anyone got any idea or suggestions.
Thanks
Alan
PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
-
- 3StarLounger
- Posts: 327
- Joined: 18 Jan 2022, 15:59
- Location: Naked, in Hof, Bavaria, Germany
PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
You do not have the required permissions to view the files attached to this post.
Sure you can give me a DVM instead, when you take the AVOmeter out of my cold dead hands,
-
- PlatinumLounger
- Posts: 5254
- Joined: 24 Jan 2010, 08:33
- Location: A cathedral city in England
Re: PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
Does the perusal of the Command Prompt SC.exe documentation assist in any way?
John Gray
The Stone Age didn't end because we ran out of stones.
The Stone Age didn't end because we ran out of stones.
-
- 3StarLounger
- Posts: 327
- Joined: 18 Jan 2022, 15:59
- Location: Naked, in Hof, Bavaria, Germany
Re: PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
Hi John,
Thx for the reply.
That doesn’t directly help me, as its way, way too heavy for me. I only just started with doing anything with these command things. Maybe someone else might be able to do something with it though to assist me, or if not , when I am better clued up on these things I might be able to use it to solve the problem later with it if no one else can help me in the meantime. So thanks anyway
Alan
P.S. It looks like one of my Most Beautiful long single line VBA code lines, Lol :)
( It took me a few years to get that far in VBA.... )
Thx for the reply.
That doesn’t directly help me, as its way, way too heavy for me. I only just started with doing anything with these command things. Maybe someone else might be able to do something with it though to assist me, or if not , when I am better clued up on these things I might be able to use it to solve the problem later with it if no one else can help me in the meantime. So thanks anyway
Alan
P.S. It looks like one of my Most Beautiful long single line VBA code lines, Lol :)
( It took me a few years to get that far in VBA.... )
Sure you can give me a DVM instead, when you take the AVOmeter out of my cold dead hands,
-
- Microsoft MVP
- Posts: 1256
- Joined: 24 May 2013, 15:33
- Location: Warminster, PA
Re: PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
I tried the value shown in the list for the start parameter in the documentation that John linked to, delayed-auto, but PowerShell didn't like that either. Here's the error message it showed in English:
Apparently there is no enumeration value in the ServiceStartMode type that corresponds to delayed-auto.
Apparently there is no enumeration value in the ServiceStartMode type that corresponds to delayed-auto.
You do not have the required permissions to view the files attached to this post.
-
- 3StarLounger
- Posts: 327
- Joined: 18 Jan 2022, 15:59
- Location: Naked, in Hof, Bavaria, Germany
Re: PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
Hi Jay,
I just tried as well, no joy either
(But always good to see it in English as well, thanks, and thanks for trying)
I thought I read somewhere something about that this option was added "later", so maybe it "missed the boat" in getting added to the available PowerShell syntax options
I just tried as well, no joy either
(But always good to see it in English as well, thanks, and thanks for trying)
I thought I read somewhere something about that this option was added "later", so maybe it "missed the boat" in getting added to the available PowerShell syntax options
You do not have the required permissions to view the files attached to this post.
Sure you can give me a DVM instead, when you take the AVOmeter out of my cold dead hands,
-
- SilverLounger
- Posts: 1840
- Joined: 25 Jan 2010, 02:12
Re: PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
I was able to use the Set_Service command to change the startup type from Manual to AutomaticDelayedStart and then back to Manual.
This is using PowerShell 7.2.1 on a Windows 11 Pro machine. Running PS as Administrator.
I get the same error when I use the built-in Windows PowerShell.
This is using PowerShell 7.2.1 on a Windows 11 Pro machine. Running PS as Administrator.
I get the same error when I use the built-in Windows PowerShell.
Joe
-
- 3StarLounger
- Posts: 327
- Joined: 18 Jan 2022, 15:59
- Location: Naked, in Hof, Bavaria, Germany
Re: PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
Thanks, that’s good to know. It perhaps supports the idea that it was added later as an option so the syntax is missing from some older things.
I think I mostly have powershell 5.1, but have not checked all my machines, just now one is slowly updating itself to the newest Windows 10, (has been all day, lol), so I will check again on that tomorrow.
I will remember to check again if/ when I get a windows 11 machine in a few weeks.
I think I mostly have powershell 5.1, but have not checked all my machines, just now one is slowly updating itself to the newest Windows 10, (has been all day, lol), so I will check again on that tomorrow.
I will remember to check again if/ when I get a windows 11 machine in a few weeks.
Sure you can give me a DVM instead, when you take the AVOmeter out of my cold dead hands,
-
- Administrator
- Posts: 76214
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
PowerShell 7.2 requires Windows 10 (version 1607 or later) or Windows 11.
PowerShell 7.0 and 7.1 also run in Windows 8.1.
PowerShell 7.0 and 7.1 also run in Windows 8.1.
Regards,
Hans
Hans
-
- SilverLounger
- Posts: 1840
- Joined: 25 Jan 2010, 02:12
Re: PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
PowerShell 7.0 and above is a separate install from the built-in PowerShell. PS7 runs side by side with the built-in version. PS7 is a new, cross-platform, open-source version. See PoweShell for in-depth documentation plus an extensive gallery of PS code.
Joe
-
- 3StarLounger
- Posts: 327
- Joined: 18 Jan 2022, 15:59
- Location: Naked, in Hof, Bavaria, Germany
Re: PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
Thx Hans, Thx Joe for the replies
I will look into PS7
I might wait until I have windows 11 and check out Terminal stuff at the same time.
For now, as I know from you the syntax that might work in newer stuff, I will leave the coding I have perhaps like this
Set-Service "dmwappushservice" -StartupType Automatic
Set-Service "dmwappushservice" -StartupType AutomaticDelayedStart
The coding I have has some sort of error handling I think , which I don’t understand yet, but it seems to ignore errors, so I assume those two line will give me Automatic (Delayed Start) if it can, otherwise make it Automatic.
( I assume Automatic is the next best thing, but that is a very uneducated guess? – Basically I have a coding that is supposed to tidy up / debloat / speed up windows 10. Mostly I have seen that virgin versions have Automatic (Delayed Start)
The coding changes that to Manual. - People smarter than me think either that or Disabled is a good idea
The coding has an undo/ restore section which is intended to put things back as they were. The coding had a few typos and simple careless mistakes, one of which was that the service "dmwappushservice" had been missed out of the undo section. As per Sod’s Law, it was the only changed Service that originally had Automatic (Delayed Start) )
I will look into PS7
I might wait until I have windows 11 and check out Terminal stuff at the same time.
For now, as I know from you the syntax that might work in newer stuff, I will leave the coding I have perhaps like this
Set-Service "dmwappushservice" -StartupType Automatic
Set-Service "dmwappushservice" -StartupType AutomaticDelayedStart
The coding I have has some sort of error handling I think , which I don’t understand yet, but it seems to ignore errors, so I assume those two line will give me Automatic (Delayed Start) if it can, otherwise make it Automatic.
( I assume Automatic is the next best thing, but that is a very uneducated guess? – Basically I have a coding that is supposed to tidy up / debloat / speed up windows 10. Mostly I have seen that virgin versions have Automatic (Delayed Start)
The coding changes that to Manual. - People smarter than me think either that or Disabled is a good idea
The coding has an undo/ restore section which is intended to put things back as they were. The coding had a few typos and simple careless mistakes, one of which was that the service "dmwappushservice" had been missed out of the undo section. As per Sod’s Law, it was the only changed Service that originally had Automatic (Delayed Start) )
Last edited by DocAElstein on 25 Jan 2022, 15:55, edited 1 time in total.
Sure you can give me a DVM instead, when you take the AVOmeter out of my cold dead hands,
-
- SilverLounger
- Posts: 1840
- Joined: 25 Jan 2010, 02:12
Re: PowerShell code line syntax for set service start up type option Automatic (Delayed Start)
There are some differences between Windows PS and PS7. See PowerShell differences for more details.
I believe that going forward PS7 is where Microsoft will devote its resources.
I believe that going forward PS7 is where Microsoft will devote its resources.
Joe