#PSTip How to get non-running automatic services

The Startup type information is not available when we use the Get-Service cmdlet. Luckily the Win32_Service WMI class has a StartMode property that we can use to create a nice server-side filter. If outer quotes are double quotes, you need to use single ones for values.

Get-WmiObject -Class Win32_Service -Filter "StartMode='Auto' AND State='Stopped'"

You can add ComputerName parameter to easily query services on a remote computer:

Get-WmiObject -Class Win32_Service -Filter "StartMode='Auto' AND State='Stopped'" –ComputerName Server01,Server02 –Credential (Get-Credential Administrator)

You cannot use the Credential parameter when you run the management operation against the local computer.

Share on:
comments powered by Disqus