< Back

Get-StoppedAutomaticService

Sat Jan 18, 2020 4:34 pm

NAME Get-StoppedAutomaticService



SYNOPSIS

This script checks a remote computer using WMI for any Automatic services that are not running.





SYNTAX

Get-StoppedAutomaticService [[-ComputerName] <String[]>] [-FilterCleanExit] [[-ExclusionList] <Object>]

[<CommonParameters>]





DESCRIPTION

The script makes a WMI query for all services that have an Automatic start mode, but are stopped.

This is useful for checking servers after patching for any services that didn't start automatically.





PARAMETERS

-ComputerName <String[]>

Enter the name of a computer or a list of computers. Accepts pipeline input. Default: localhost.



Required? false

Position? 1

Default value $env:COMPUTERNAME

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-FilterCleanExit [<SwitchParameter>]

Use to automatically exclude services which start but then exit because they have nothing else

to do (or are trigger start). Use this switch if you need to filter out services that stopped

cleanly with an exit code 0.



Required? false

Position? named

Default value False

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-ExclusionList <Object>

Service names that should be excluding from the query. A default list of known services that are set to

Automatic but do not run (i.e. Performance Logs and Alerts) is provided.



Required? false

Position? 2

Default value @('clr_optimization_v4.0.30319_32','clr_optimization_v4.0.30319_64','SysmonLog','S

hellHWDetection','sppsvc','gupdate','MMCSS','RemoteRegistry','ccmsetup')

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





By: Jason Wasser

Modified: 4/27/2015 09:50:22 AM

Changelog:

* Removed OutputType since it wasn't working consistently.

* Rewrite script to output actual service objects.



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-StoppedAutomaticService -ComputerName server1



Lists the stopped automatic services from server1.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-StoppedAutomaticService -ComputerName server1,server2



Lists the stopped automatic services from server1 and server2.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-StoppedAutomaticService -ComputerName (Get-Content c:\\temp\\computerlist.txt)



Lists the stopped automatic services from a list of computers in a text file.









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-StoppedAutomaticService -FilterCleanExit



Get a list of stopped automatic services that exited cleanly. This should exclude services that do start,

but have no further work to do (includes Trigger Start)









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Get-Content C:\\Temp\\serverlist.txt | Get-StoppedAutomaticService | Start-Service



Get a list of stopped automatic services from a list of computers and then start the services.











RELATED LINKS