PowerShell Start-Service Cmdlet
Hello Everyone
Welcome to CloudAffaire and this is Debjeet.
In the last blog post, we have discussed Stop-Service cmdlet in PowerShell.
https://cloudaffaire.com/powershell-stop-service-cmdlet/
In this blog post, we will discuss Start-Service cmdlet in PowerShell. You can use Start-Service cmdlet to start windows services. Start-Service cmdlet start a service by sending a start message to the windows service controller. You can use parameters like ‘name’,’displayname’ or ‘inputobject’ to pass the service name to Start-Service cmdlet. If the service is already running, service controller ignores the start message. You need to have permission to manage windows service to use Start-Service cmdlet.
Start-Service Cmdlet Syntax:
1 2 3 4 5 6 7 8 |
## Start-Service ## [-InputObject] ## [-PassThru] ## [-Include ## [-Exclude ## [-WhatIf] ## [-Confirm] ## [ |
Start-Service Cmdlet Argument List:
- –Confirm: Prompts you for confirmation before running the cmdlet.
- –DisplayName: Specifies the display names of the services to start. Wildcard characters are permitted.
- –Exclude: Specifies services that this cmdlet omits. The value of this parameter qualifies the Name parameter.
- –Include: Specifies services that this cmdlet starts. The value of this parameter qualifies the Name parameter.
- –InputObject: Specifies ServiceController objects representing the services to be started. Enter a variable that contains the objects, or type a command or expression that gets the objects.
- –Name: Specifies the service names for the service to be started.
- –PassThru: Returns an object that represents the service. By default, this cmdlet does not generate any output.
- –WhatIf: Shows what would happen if the cmdlet runs. The cmdlet is not run.
PowerShell Start-Service Cmdlet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
######################################### ## PowerShell | Cmdlet | Start-Service ## ######################################### ## PowerShell Latest Version (5) ## open PowerShell terminal as admin ## get all the windows services that are running Get-Service | Where-Object {$_.Status -eq "Running"} ## start a windows service in PowerShell Start-Service -Name "WerSvc" Get-Service -Name "WerSvc" ## start a windows service by display name in PowerShell Start-Service -DisplayName "Windows Defender Firewall" Get-Service -DisplayName "Windows Defender Firewall" |
Hope you have enjoyed this article. In the next blog post, we will discuss Restart-Service CmdLet in PowerShell.
To Set more details on PowerShell, kindly follow below official documentation