Stops and then starts one or more services. (Restart-Service)

   

# NAME
Restart-Service

# SYNOPSIS
Stops and then starts one or more services.

# SYNTAX
Restart-Service [-Name] <string[]> [-Exclude <string[]>] [-Force] [-Include <string[]>] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]

Restart-Service -DisplayName <string[]> [-Exclude <string[]>] [-Force] [-Include <string[]>] [-PassThru] [-Confirm] [-WhatIf] [<CommonParameters>]

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

# DESCRIPTION
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.

# PARAMETERS
-DisplayName <string[]>
Specifies the display names of services to be restarted. Wildcards are permitted.

Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Exclude <string[]>
Omits the specified services. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as "s*". Wildcards are permitted.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Force [<SwitchParameter>]
Overrides restrictions that prevent the command from succeeding, just so the changes do not compromise security. For example, Force will stop and restart a service that has dependent services.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Include <string[]>
Restarts only the specified services. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as "s*". Wildcards are permitted.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-InputObject <ServiceController[]>
Specifies ServiceController objects that represent the services to be restarted. Enter a variable that contains the objects, or type a command or expression that gets the objects.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

-Name <string[]>
Specifies the service names of the services to be restarted.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false

-PassThru [<SwitchParameter>]
Returns an object that represents the service. By default, this cmdlet does not generate any output.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-Confirm [<SwitchParameter>]
Prompts you for confirmation before executing the command.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-WhatIf [<SwitchParameter>]
Describes what would happen if you executed the command without actually executing the command.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
System.ServiceProcess.ServiceController, System.String
You can pipe a service object or a string that contains a service name to Restart-Service.

# OUTPUTS
None or System.ServiceProcess.ServiceController
When you use the PassThru parameter, Restart-Service generates a System.ServiceProcess.ServiceController object that represents the restarted service. Otherwise, this cmdlet does not generate any output.

# NOTES

Restart-Service can control services only when the current user has permission to do so. If a command does not work correctly, you might not have the required permissions.

To find the service names and display names of the services on your system, type "get-service". The service names appears in the Name column, and the display names appear in the DisplayName column.

# EXAMPLE 1

C:\PS>restart-service wmi

# Description
-----------
This command restarts the Windows Management Instrumentation (WMI) service on the local computer.

# EXAMPLE 2

C:\PS>restart-service -displayname net* -exclude "net logon"

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

# EXAMPLE 3

C:\PS>get-service net* | where-object {$_.Status -eq "Stopped"} | restart-service

# Description
-----------
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.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=113385
Start-Service
Stop-Service
Suspend-Service
Resume-Service
New-Service
Get-Service
Set-Service

C:\Windows>powershell get-help Set-Service -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows 10, 8.1, 8, 7, Vista / Windows Server 2016, 2012, 2008
»»»» ColorConsole





... Home  
... Impressum
... ColorConsole

... CMD
... Netsh-XP
... Netsh-7
... Netsh-Vista
... Powershell










Download the Windows 10 Starter, Home (Basic Premium), Professional und Ultimate!

... facebook.de
HTTP: ... PS_Windows/en/Restart-Service.htm
0.031

Wartezeiten beim Herunterfahren von Windows verkürzen!

 /

Wie kann ich die Bookmarks von FLOCK importieren ?

 /

Auto Shutdown in Windows 8, 10 und 8.1 (herunterfahren)!

 /

Kann man in Windows-8 Desktop -Symbole automatisch anordnen- deaktivieren (Windows 8.1, 7, 10)?

 /