This is the third post for Windows services. You can access previous posts using below link.
Managing Windows services from command line
Get status of a service using Get-Service cmdlets
The Get-Service cmdlets allow you to list services on local computer.
Examples: List all services on the computer
PS C:\> Get-Service
Status Name DisplayName
------ ---- -----------
Running AdobeARMservice Adobe Acrobat Update Service
Stopped AJRouter AllJoyn Router Service
Stopped ALG Application Layer Gateway Service
Stopped AppReadiness App Readiness
Stopped BDESVC BitLocker Drive Encryption Service
Examples: List all services which match a search string
PS C:\> Get-Service -DisplayName "*Application*"
Status Name DisplayName
------ ---- -----------
Stopped ALG Application Layer Gateway Service
Stopped AppIDSvc Application Identity
Running Appinfo Application Information
Stopped AppMgmt Application Management
Stopped COMSysApp COM+ System Application
Examples: List all Running Services
PS C:\> Get-Service | Where-Object {$_.Status -eq "Running"}
Status Name DisplayName
------ ---- -----------
Running AdobeARMservice Adobe Acrobat Update Service
Running Appinfo Application Information
Running AppXSvc AppX Deployment Service (AppXSVC)
Running aswbIDSAgent aswbIDSAgent
Running AudioEndpointBu... Windows Audio Endpoint Builder
Examples: Get status of specific service
PS C:\> Get-Service -Name BITS
Examples: Get status of specific service on Remote Computer To get the status of a service on remote computer you just need to add -ComputerName parameter
PS C:\> Get-Service -ComputerName Desktop-9OP8RCA -Name BITS
Status Name DisplayName
------ ---- -----------
Running BITS Background Intelligent Transfer Ser...
Start and Stop service using Start-Service and Stop-Service cmdlets As name suggest, the Stop-Service cmdlets allow you to stop a service while Start-Service cmdlets allow you to start a service. The below examples show usage of both cmdlets to start / stop service on local or remote computer.
Examples: Stop a service
PS C:\> Stop-Service -Name BITS
Another way is to get a service using Get-Service cmdlets and then pass the output to Stop-Service cmdlets using Piping.
PS C:\> Get-Service -Name BITS | Stop-Service
The benefits of using second methods is that it support remote services as well. While Get-Service cmdlet support remote services, Start-Service and Stop-Service cmdlets do not. However, the result can be achieved by usage of Piping. See the below example to understand how Piping was used to start and stop a service on remote computer
Do you need an offline copy (PDF , ebook) of all Windows services articles? Download a free copy from Techuisitive Store or below link.
Related Posts:
- Windows 10 – Remote administration through PowerShell – Part 1
- Windows Administrator Basics: Managing Services from Command Line
- Windows Administrator Basics: Windows Services
- Windows Administrator Basics: Managing Windows Services from Powershell
- Windows Administrator Basics: Windows Registry
- Basic Knowledge for Windows Desktop Support Engineer
- Windows 10 /11 : Create a virtual drive with SUBST command
Subscribe to Techuisitive Newsletter
Be the first to know about our new blog posts. Get our newsletters directly in your inbox and stay up to date about Modern Desktop Management technologies & news.