Get startup type of Windows service using PowerShell

How can I get the Windows service startup type using PowerShell and not using WMI?

I looked inside the Get-Service command, and it does not provide something to display the "startup type".


Solution 1:

WMI is the way to do this.

Get-WmiObject -Query "Select StartMode From Win32_Service Where Name='winmgmt'"

Or

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

Solution 2:

With PowerShell version 4:

You can run a command as given below:

   Get-Service | select -property name,starttype

Solution 3:

In PowerShell you can use the command Set-Service:

Set-Service -Name Winmgmt -StartupType Manual

I haven't found a PowerShell command to view the startup type though. One would assume that the command Get-Service would provide that, but it doesn't seem to.