PowerShell Logo Small


This is the built-in help made by Microsoft for the command 'Restart-Service', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.


Stops and then starts one or more services.


Restart-Service [-InputObject] <ServiceController[]> [-Exclude [<String[]>]] [-Force] [-Include [<String[]>]] [-InformationAction {SilentlyContinue | Stop | Continue |
Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [-PassThru] [<CommonParameters>]
Restart-Service [-Exclude [<String[]>]] [-Force] [-Include [<String[]>]] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}]
[-InformationVariable [<System.String>]] [-PassThru] -DisplayName <String[]> [<CommonParameters>]
Restart-Service [-Name] <String[]> [-Exclude [<String[]>]] [-Force] [-Include [<String[]>]] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore |
Suspend}] [-InformationVariable [<System.String>]] [-PassThru] [<CommonParameters>]

Search powershellhelp.space


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.



Online Version: http://go.microsoft.com/fwlink/p/?linkid=293906




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

PS C:\>Restart-Service winmgmt

This command restarts the Windows Management Instrumentation service (WinMgmt) on the local computer.

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

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

This command restarts the services that have a display name that begins with "Net", except for the "Net Logon" service.

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

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

This command starts all of the stopped network services on the computer.

It uses the Get-Service cmdlet to get objects representing the services whose service name begins with "net". (The optional Name parameter name is omitted.) The pipeline
operator (|) sends the services object to the Where-Object cmdlet, which selects only the services with a status of "stopped." Another pipeline operator sends the selected
services to Restart-Service. In practice, you would use the WhatIf parameter to see the effect of the command before using it.