- PowerShell Tutorial
- PowerShell - Home
- PowerShell - Overview
- PowerShell - Environment Setup
- PowerShell - Cmdlets
- PowerShell - Files and Folders
- PowerShell - Dates and Timers
- PowerShell - Files I/O
- PowerShell - Advanced Cmdlets
- PowerShell - Scripting
- PowerShell - Special Variables
- PowerShell - Operators
- PowerShell - Looping
- PowerShell - Conditions
- PowerShell - Array
- PowerShell - Hashtables
- PowerShell - Regex
- PowerShell - Backtick
- PowerShell - Brackets
- PowerShell - Alias
- PowerShell Useful Resources
- PowerShell - Quick Guide
- PowerShell - Useful Resources
- PowerShell - Discussion
Powershell - Select-Object Cmdlet
Cmdlet
Select-Object cmdlet is used to select object or its properties.
In these example, we're see the Select-Object cmdlet in action.
Example 1
In this example, we'll create objects using Process properties.
Get-Process | Select-Object -Property ProcessName, Id, WS -Last 5
Output
You can see the following output.
ProcessName Id WS ----------- -- -- UNS 2624 10301440 wininit 624 4935680 winlogon 552 7774208 WLTRYSVC 3080 3608576 WmiPrvSE 1620 11870208
Example 2
In this example, we'll select unique values of an array.
"a","b","c","a","a","a" | Select-Object -Unique
Output
You can see the following output.
a b c
powershell_advanced_cmdlets.htm
Advertisements