Contact Info

Crumbtrail » Administration » Powershell » Powershell 1.0 » Select-Object

Select-Object - Powershell 1.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Select properties of objects.


-property Object[]
       The property or properties to select.

   -excludeProperty string
       Properties that will not be selected.
   -expandProperty string
       Select and expand the specified property. If the specified property is  
       an array, for example, each value of the array should be included.

   -first int
       Select int number of objects from the beginning of an array of input objects.
   -last int
       Select int number of objects from the end of an array of input objects.

       Select unique objects only, (identical properties and values)
   -inputObject psobject
       An object or objects to input to Select-Object. May be pipelined.

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

Display only the name, ID and Working Set(WS) properties of Get-Process:

PS C:\>get-process | select-object ProcessName,Id,WS

Display only the Name and modules properties of Get-Process, use -ExpandProperty to display the details contained within the modules property:

PS C:\>get-process | select-object ProcessName -expandproperty modules | format-list

Display the 5 processes that are using the most memory (WS=Working Set):

PS C:\>get-process | sort-object -property WS | select-object -Last 5

Display the name and claculate the start day of the processes running:

PS C:\>get-process | select-object ProcessName,@{Name="Start Day"; Expression={$_.StartTime.DayOfWeek}}