Selecting and sorting
Select-Object
acts on an input pipeline; either an existing collection of objects, or the output from another command. Select-Object
can be used to select a subset of properties, to change properties, or to add new properties. Select-Object
also allows a user to limit the number of objects returned.
Sort-Object
can be used to perform both simple and complex sorting based on an input pipeline.
Using Select-Object
is a key part of working with PowerShell, output can be customized to suit circumstances in a number of ways.
The Select-Object command
Select-Object
is an extremely versatile command as shown by each of the following short examples, which demonstrate some of the simpler uses of the command.
Select-Object
may be used to limit the properties returned by a command by name:
Get-Process | Select-Object -Property Name, Id
Select-Object
can limit the properties returned from a command using wildcards:
Get-Process | Select-Object...