Stop and then restart one or more services.
Syntax Restart-Service { [-name] string[] | [-displayName] string[] | [-inputObject ServiceController[]] } [-force] [-include string[]] [-exclude string[]] [-passthru] [-whatIf] [-confirm] [CommonParameters] Key -name string The service names to be restarted. -displayName string The display names to be restarted, wildcards are permitted. -inputObject ServiceController Restart the services represented by ServiceController. Enter a command, expression or variable containing the object(s). -force Override restrictions that prevent the command from succeeding, apart from security settings. e.g. -Force will stop and restart a service that has dependent services. -include string Restart only the specified services. Qualifies the -Name parameter. Wildcards , such as "s*" are permitted. -exclude string Omit the specified services e.g. "*windevcluster*" Qualifies the -Name parameter, Wildcards are permitted. -passThru Pass the object created by Restart-Service along the pipeline. -whatIf Describe what would happen if you executed the command without actually executing the command. -confirm Prompt for confirmation before executing the command.
Restart the spooler (printing) service:
PS C:\> Restart-Service spooler -force
Find all the network services on the computer (starting with "net...") and restart any that are stopped:
PS C:\> Get-Service net* | where {$_.Status -eq "Stopped"} | Restart-Service
“DALEK: Halt at once. Halt or you will be exterminated. It is the Doctor.
The Doctor must be destroyed. Exterminate. Exterminate. Exterminate!” ~ Dr Who, 1983
Get-Service - Get a list of services.
New-Service - Create a new service.
Resume-Service - Resume a suspended service.
Set-Service - Make and set changes to the properties of a service.
Start-Service - Start a stopped service.
Stop-Service - Stop a running service.
Suspend-Service - Suspend a running service.
Windows cmd commands:
NET START /
SC - Service Control.