Get-Service

Get the services on the local computer.

Syntax
      Get-Service { [-name] string[] | -displayName string[]
                                     | -inputObject ServiceController[] }
         [-include string[]] [-exclude string[]]
             [CommonParameters]
Key
   -name          Service names to retrieve. Wildcards are permitted. 
   
   -displayName   Display names of services to retrieve. Wildcards permitted.
		 
   -inputObject   ServiceController object(s) to retrieve.
                  A variable containing objects or a command / expression that
                  gets the objects.

   -Include       Retrieve only the Service Name(s) specified

   -Exclude       Omit the Service Name(s) specified

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

By default, Get-Service will return all the services on the computer.

Examples

Get all the services on the computer.:

PS C:\>get-service

Get services with names that begin "WMI":

PS C:\>get-service wmi*

Display only services that are currently running:

PS C:\>get-service | where-object {$_.Status -eq "Running"}

Status is only one property of service objects, to see all the properties: get-service | get-member
To retrieve the description of a service use the Win32_Service WMI class:

PS C:\>get-wmiobject win32_service | where-object {$_.Name -eq "Schedule"} | format-list Name, Description

"Events dear boy, events" - Harold Macmillan (response when asked "what is most likely to blow governments off course")

Related:

New-Service - Create a new service
Restart-Service
- Restart a stopped service
Resume-Service
- Resume a suspended service
Set-Service
- Make and set changes to the properties of a service
Start-Service
- Start a stopped service
Stop-Service
- Stop a running service
Suspend-Service
- Suspend a running service
Windows cmd command: NET START / SC - Service Control



Back to the Top

© Copyright SS64.com 1999-2010
Some rights reserved