PowerShell Logo Small

Start-Service



This is the built-in help made by Microsoft for the command 'Start-Service', in PowerShell version 4 - as retrieved from Windows version 'Microsoft Windows 8.1 Enterprise' 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.

SYNOPSIS

Starts one or more stopped services.

SYNTAX


Start-Service [-InputObject] <ServiceController[]> [-Exclude <String[]>] [-Include <String[]>] [-PassThru] [<CommonParameters>]
Start-Service [-Exclude <String[]>] [-Include <String[]>] [-PassThru] -DisplayName <String[]> [<CommonParameters>]
Start-Service [-Name] <String[]> [-Exclude <String[]>] [-Include <String[]>] [-PassThru] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Start-Service cmdlet sends a start message to the Windows Service Controller for each of the specified services. If a service is already running, the message is i
gnored without error. You can specify the services by their service names or display names, or you can use the InputObject parameter to supply a service object repres
enting the services that you want to start.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=293919
Get-Service
New-Service
Restart-Service
Resume-Service
Set-Service
Stop-Service
Suspend-Service

REMARKS

<

Examples


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

PS C:\>start-service -name eventlog



This command starts the EventLog service on the local computer. It uses the Name parameter to identify the service by its service name.








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

PS C:\>start-service -displayname *remote* -whatif



This command tells what would happen if you started the services with a display name that includes "remote". It uses the DisplayName parameter to specify the services
by their display name instead of by their service name. And, it uses the WhatIf parameter to tell what would happen if the command were executed instead of executing
the command.








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

PS C:\>$s = get-service wmi
PS C:\>start-service -InputObject $s -passthru | format-list >> services.txt



These commands start the Windows Management Instrumentation (WMI) service on the computer and add a record of the action to the services.txt file. The first command u
ses the Get-Service cmdlet to get an object representing the WMI service and store it in the $s variable.

The second command uses the Start-Service cmdlet to start the WMI service. It identifies the service by using the InputObject parameter to pass the $s variable contai
ning the WMI service object to Start-Service. Then, it uses the PassThru parameter to create an object that represents the starting of the service. Without this param
eter, Start-Service does not create any output.

The pipeline operator (|) passes the object that Start-Service creates to the Format-List cmdlet, which formats the object as a list of its properties. The append red
irection operator (>>) redirects the output to the services.txt file, where it is added to the end of the existing file.








-------------------------- EXAMPLE 4 --------------------------

PS C:\>start-service tlntsvr
Start-Service : Service 'Telnet (TlntSvr)' cannot be started due to the following error: Cannot start service TlntSvr on computer '.'.
At line:1 char:14
+ start-service <<<< tlntsvrPS C:\>get-wmiobject win32_service | where-object {$_.Name -eq "tlntsvr"}

ExitCode : 0
Name : TlntSvr
ProcessId : 0
StartMode : Disabled
State : Stopped
Status : OKPS C:\>set-service tlntsvr -startuptype manualPS C:\>start-service tlntsvr



This series of commands shows how to start a service when the start type of the service is "Disabled". The first command, which uses the Start-Service cmdlet to start
the Telnet service (tlntsvr), fails.

The second command uses the Get-WmiObject cmdlet to get the Tlntsvr service. This command retrieves an object with the start type property in the StartMode field. The
resulting display reveals that the start type of the Tlntsvr service is "Disabled".

The next command uses the Set-Service cmdlet to change the start type of the Tlntsvr service to "Manual".

Now, we can resubmit the Start-Service command. This time, the command succeeds.

To verify that the command succeeded, run Get-Service.