Windows Service "Startup" type not a property of get-service

This topic contains 4 replies, has 3 voices, and was last updated by  Kambo 1 week, 3 days ago.

  • Author
    Posts
  • #26410

    Hassan MS
    Participant

    Hi,
    I am just wondering if I am doing something wrong or this is true that Get-service cmdlet does not have "Startup type" as the Property (member type) –
    see
    Get-service -name "service name" | gm

    CanPauseAndContinue Property
    CanShutdown Property
    CanStop Property
    Container Property
    DependentServices Property
    DisplayName Property
    MachineName Property
    ServiceHandle Property
    ServiceName Property
    ServicesDependedOn Property
    ServiceType Property
    Site Property
    Status Property

    so how can I find out the startup type of a Windows service using PowerShell get-service?
    is there another cmdlet or name that does the job?

  • #26411

    Jeremie Lauzier
    Participant

    Hi,

    Get-Service does not have an option to find the startup type.
    But you can use this :

    Get-WmiObject -Class Win32_Service -Property StartMode -Filter "Name='ServiceName'"
    

    Have a good day !

  • #26412

    Jeremie Lauzier
    Participant

    Sorry, my previous post didn't go well. And I don't have the Edit button so...

    This is the command : Get-WmiObject -Class Win32_Service -Property StartMode -Filter "Name='ServiceName'"

  • #26512

    Hassan MS
    Participant

    Thank you

  • #100651

    Kambo
    Participant

    This should give startup mode of all services;

    Get-CimInstance -ClassName Win32_Service | Where-Object startmode -EQ 'Auto' | FT Displayname, name, startmode, started -AutoSize

    For troubleshooting, often we need to determine services whose startup-mode is 'Automatic' but are not running. The following command will do this;

    Get-CimInstance -ClassName Win32_Service | Where-Object startmode -EQ 'Auto' | FT Displayname, name, startmode, started -AutoSize | Findstr /c:"started" /c:"False"

You must be logged in to reply to this topic.