Script to get all "stopped" services with startup type "automatic" -- Windows
By looking at this question you could come up with this for old versions of PowerShell:
Get-WmiObject -Class Win32_Service | Select-Object Name,State,StartMode | Where-Object {$_.State -ne "Running" -and $_.StartMode -eq "Auto"}
With newer Versions (at least 5 maybe 3/4) you could also use (which was suggested by JC2k8):
Get-Service | Select-Object -Property Name,Status,StartType | Where-Object {$_.Status -eq "Stopped" -and $_.StartType -eq "Automatic"}
In older versions of PowerShell the Get-Service
cmdlet doesn't offer a member that has the StartType
.
PowerShell supports a lot of filtering and piping. :)
(get-service|?{ $_.Status -eq "Stopped" -and $_.StartType -eq "Automatic"})|
select DisplayName, StartType, Status