#powershell Get-Service StartType Property

Commencing with PowerShell v5, the startup type of a conventional Windows NT service is available as the StartType property with a call to the basic Get-Service cmdlet. Ironically, this property going by the name StartupType is already configuarable pre P5 using Set-Service (local administrative permissions needed).

In prior PS versions, a similar attribute StartMode can only be retrieved using Get-WmiObject plus the -Query or -Filter/-Property parameters:

gwmi -query “Select StartMode from Win32_Service Where Name=’wuauserv'”

gwmi -class Win32_Service -Property StartMode -Filter “Name=’wuauserv'”

Alternatively,

&”$env:windir/system32/sc.exe” qc wuauserv | sls START_TYPE

gives the required value under START_TYPE.

Bookmark the permalink.

Leave a Reply