CmdID / PowerShell / Cmdlets / Get
Get-Service
Gets the services on a local or remote computer. PowerShell reference
From the PowerShell reference
8 parameters
Alias gsv
What it does
Gets the services on a local or remote computer. The Get-Service cmdlet gets objects that represent the services on a computer, including running and stopped services. By default, when Get-Service is run without parameters, all the local computer's services are returned. You can direct this cmdlet to get only particular services by specifying the service name or the display name of the services, or you can pipe service objects to this cmdlet.
Get-Service [[-Name] <String[]>] [-ComputerName <String[]>] [-DependentServices] [-RequiredServices] [-Include <String[]>] [-Exclude <String[]>] [<CommonParameters>]Get-Service [-ComputerName <String[]>] [-DependentServices] [-RequiredServices] -DisplayName <String[]> [-Include <String[]>] [-Exclude <String[]>] [<CommonParameters>]Get-Service [-ComputerName <String[]>] [-DependentServices] [-RequiredServices] [-Include <String[]>] [-Exclude <String[]>] [-InputObject <ServiceController[]>] [<CommonParameters>]
Get all services on the computer
Get-ServiceIdentifyGet services that begin with a search string
Get-Service "wmi*"IdentifyDisplay services that include a search string
Get-Service -DisplayName "network"IdentifyGet services that begin with a search string and an exclusion
Get-Service -Name "win*" -Exclude "WinRM"IdentifyDisplay services that are currently active
Get-Service | Where-Object {$_.Status -eq "Running"}IdentifyGet the services on a remote computer
Get-Service -ComputerName "Server02"IdentifyList the services on the local computer that have dependent services
Get-Service |
Where-Object {$_.DependentServices} |
Format-List -Property Name, DependentServices, @{
Label="NoOfDependentServices"; Expression={$_.DependentServices.Count}
}IdentifySort services by property value
Get-Service "s*" | Sort-Object StatusIdentifyGet services on multiple computers
Get-Service -Name "WinRM" -ComputerName "localhost", "Server01", "Server02" |
Format-Table -Property MachineName, Status, Name, DisplayName -AutoIdentifyGet the dependent services of a service
Get-Service "WinRM" -RequiredServicesIdentifyIts page in the reference: Get-Service.
Parameters
-ComputerNameGets the services running on the specified computers. The default is the local computer.
This parameter does not rely on Windows PowerShell remoting. You can use the ComputerName parameter of Get-Service even if your computer is not configured to run remote commands.-DependentServicesIndicates that this cmdlet gets only the services that depend upon the specified service.-DisplayNameSpecifies, as a string array, the display names of services to be retrieved. Wildcards are permitted.-ExcludeSpecifies, as a string array, a service or services that this cmdlet excludes from the operation. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as s*. Wildcards are permitted.-IncludeSpecifies, as a string array, a service or services that this cmdlet includes in the operation. The value of this parameter qualifies the Name parameter. Enter a name element or pattern, such as s*. Wildcards are permitted.-InputObjectSpecifies ServiceController objects representing the services to be retrieved. Enter a variable that contains the objects, or type a command or expression that gets the objects. You can pipe a service object to this cmdlet.-NameSpecifies the service names of services to be retrieved. Wildcards are permitted.-RequiredServicesIndicates that this cmdlet gets only the services that this service requires. This parameter gets the value of the ServicesDependedOn property of the service.