< Back

Start-StoppedAutomaticService

Sat Jan 18, 2020 4:34 pm

NAME Start-StoppedAutomaticService



SYNOPSIS

This script starts any stopped Automatic services with exclusions.





SYNTAX

Start-StoppedAutomaticService [[-ComputerName] <String[]>] [-FilterCleanExit] [<CommonParameters>]





DESCRIPTION

The script defaults to check the localhost for any stopped Automatic services and

starts them. It can also run against a single remote computer or a list of remote

computers. The script will first check to see if ws-man remoting is enabled, and

if it isn't it will fall back to using the sc.exe utility to start the services.

The script assumes you have administrative rights on the remote computer.



The $FilterCleanExit switch is for excluding any services that have an exit

code of zero which typically means services that have nothing to do or were

stopped gracefully.



Created by: Jason Wasser

Modified: 4/27/2015 09:17:32 AM

Version 1.2



Changelog:

* Re-write to use new Get-StoppedAutomaticService function





PARAMETERS

-ComputerName <String[]>

The computer name on which you wish to start services.



Required? false

Position? 1

Default value $env:COMPUTERNAME

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-FilterCleanExit [<SwitchParameter>]

Exclude stopped services with an exit code 0.



Required? false

Position? named

Default value False

Accept pipeline input? true (ByPropertyName)

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



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



PS C:\\>Start-StoppedAutomaticServices



Starts any stopped automatic services on the local machine.









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



PS C:\\>Start-StoppedAutomaticServices.ps1 -ComputerName server23



Starts any stopped automatic services on server23









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



PS C:\\>Start-StoppedAutomaticServices.ps1 -ComputerName (Get-Content c:\\temp\\computerlist.txt) -FilterCleanExit



Starts any stopped automatic services on a list of computers in the text file c:\\temp\\computerlist.txt and

excludes any services that were cleanly stopped.











RELATED LINKS