Aracılığıyla paylaş


Using the Format-List Cmdlet

Displaying Data as a List

Many cmdlets (Get-Service, to name one) are designed to display retrieved information in the form of a table. There may be times, however, when you would prefer to have information displayed as a list (particularly if the resulting table has too many columns to fit nicely on the screen). As you might expect, the Format-List cmdlet is here to help you display information as a list.

To begin with, here’s what the default output for the Get-Service cmdlet looks like:

Status   Name               DisplayName
------   ----               -----------
Running  AdobeActiveFile... Adobe Active File Monitor V4
Stopped  Alerter            Alerter
Running  ALG                Application Layer Gateway Service

And here’s what the output looks like when it gets piped through Format-List:

Name                : Spooler
DisplayName         : Print Spooler
Status              : Running
DependentServices   : {}
ServicesDependedOn  : {RPCSS}
CanPauseAndContinue : False
CanShutdown         : True
CanStop             : True
ServiceType         : Win32OwnProcess, InteractiveProcess

As you can see, the default formatter in Windows PowerShell displays just three property values in a table any time you call Get-Service. One way to get at all the available properties and their values is to call Get-Service and then pipe the output through Format-List.

That’s a good question: how do we pipe output through Format-List? Here’s how:

Get-Service | Format-List

It’s that easy.

Format-List Aliases
  • fl