CmdID

CmdID / PowerShell / Cmdlets / Restart

Restart-Service

Stops and then starts one or more services. PowerShell reference

From the PowerShell reference 9 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Stops and then starts one or more services. The Restart-Service cmdlet sends a stop message and then a start message to the Windows Service Controller for a specified service. If a service was already stopped, it is started without notifying you of an error. You can specify the services by their service names or display names, or you can use the InputObject parameter to pass an object that represents each service that you want to restart.

Restart-Service [-Force] [-InputObject] <ServiceController[]> [-PassThru] [-Include <String[]>] [-Exclude <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Restart-Service [-Force] [-Name] <String[]> [-PassThru] [-Include <String[]>] [-Exclude <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
Restart-Service [-Force] [-PassThru] -DisplayName <String[]> [-Include <String[]>] [-Exclude <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

Restart a service on the local computer

PS C:> Restart-Service -Name winmgmtIdentify

Exclude a service

PS C:> Restart-Service -DisplayName "net*" -Exclude "net logon"Identify

Start all stopped network services

PS C:> Get-Service -Name "net*" | Where-Object {$_.Status -eq "Stopped"} | Restart-ServiceIdentify

Its page in the reference: Restart-Service.

Parameters

9 in the PowerShell reference
-DisplayNameSpecifies the display names of the services to restarted. Wildcard characters are permitted.
-ExcludeSpecifies services that this cmdlet omits. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as s*. Wildcard characters are permitted.
-ForceForces the command to run without asking for user confirmation.
-IncludeSpecifies services that this cmdlet restarts. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as s*. Wildcard characters are permitted.
-InputObjectSpecifies ServiceController objects that represent the services to restart. Enter a variable that contains the objects, or type a command or expression that gets the objects.
-NameSpecifies the service names of the services to restart.
-PassThruReturns an object that represents the service. By default, this cmdlet does not generate any output.
-ConfirmPrompts you for confirmation before running the cmdlet.
-WhatIfShows what would happen if the cmdlet runs. The cmdlet is not run.