Get the services on the local computer.
Syntax
Get-Service { [-name] string[] | -displayName string[]
| -inputObject ServiceController[] }
[-ComputerName string[]] [-DependentServices]
[-include string[]] [-exclude string[]]
[-RequiredServices] [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.
-ComputerName string[]
Get the services running on the specified computers.
The default is the local computer.
Type the NetBIOS name, an IP address, or a fully qualified domain
name of a remote computer.
To specify the local computer, type the computer name, a dot (.), or "localhost".
This parameter does not rely on PowerShell remoting.
-DependentServices
Get only the services that depend upon the specified service.
By default, Get-Service gets all services.
-Include
Retrieve only the Service Name(s) specified.
Qualifies the -Name parameter, Wildcards are permitted.
-Exclude
Omit the Service Name(s) specified.
Qualifies the -Name parameter, Wildcards are permitted.
-RequiredServices
Get only the services that this service requires.
This parameter gets the value of the ServicesDependedOn property of the service.
By default, Get-Service gets all services.
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -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 all the services on the computer Server64:
PS C:\> get-service -computername Server64
Get services with names that begin "WMI" and sort the result by the service status (running/stopped):
PS C:\> get-service wmi* | sort-object status
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
© Copyright SS64.com 1999-2013
Some rights reserved