0
0
PowerShellscripting~10 mins

Select-Object for properties in PowerShell - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Select-Object for properties
Get objects
Pipe to Select-Object
Specify properties to keep
Output objects with selected properties
Display or use filtered objects
This flow shows how objects are passed through Select-Object to keep only chosen properties before output.
Execution Sample
PowerShell
Get-Process | Select-Object -Property Id, ProcessName
This command gets running processes and shows only their Id and ProcessName properties.
Execution Table
StepActionInput Object PropertiesSelected PropertiesOutput Object Properties
1Get-Process retrieves a process objectId, ProcessName, CPU, Handles, ...N/AId, ProcessName, CPU, Handles, ...
2Pipe object to Select-ObjectId, ProcessName, CPU, Handles, ...Id, ProcessNameId, ProcessName
3Select-Object outputs object with only Id and ProcessNameId, ProcessName, CPU, Handles, ...Id, ProcessNameId, ProcessName
4Output displayed with filtered propertiesN/AN/AId=1234, ProcessName='powershell'
ExitNo more objectsN/AN/AEnd of output
💡 All input objects processed; output contains only selected properties.
Variable Tracker
VariableStartAfter Step 1After Step 2Final
ProcessObjectN/A{Id=1234, ProcessName='powershell', CPU=10, Handles=50}{Id=1234, ProcessName='powershell'}{Id=1234, ProcessName='powershell'}
Key Moments - 2 Insights
Why do we see fewer properties in the output after using Select-Object?
Select-Object filters the input objects to include only the properties you specify, as shown in execution_table step 3 where output has only Id and ProcessName.
Does Select-Object change the original objects?
No, it creates new objects with only the selected properties, leaving original objects unchanged, as seen in variable_tracker where original properties exist before filtering.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 2, which properties are selected by Select-Object?
ACPU and Handles
BId and ProcessName
CAll properties
DNo properties
💡 Hint
Check the 'Selected Properties' column at step 2 in execution_table.
At which step does the output object lose properties like CPU and Handles?
AStep 3
BStep 1
CStep 2
DExit
💡 Hint
Look at the 'Output Object Properties' column in execution_table to see when properties are filtered.
If you add -Property CPU to Select-Object, how would the output properties change?
AOutput would include all properties
BOutput would include only CPU
COutput would include Id, ProcessName, and CPU
DOutput would be empty
💡 Hint
Think about how Select-Object filters properties as shown in execution_table and variable_tracker.
Concept Snapshot
Select-Object filters objects to keep only specified properties.
Syntax: Get-Command | Select-Object -Property Prop1, Prop2
It outputs new objects with only those properties.
Useful to simplify output or prepare data for next steps.
Full Transcript
This lesson shows how Select-Object works in PowerShell to pick only certain properties from objects. First, objects like processes are retrieved with many properties. Then, Select-Object filters these to keep only the properties you want, like Id and ProcessName. The output shows just those properties, making data easier to read or use. The original objects remain unchanged. This is useful when you want to focus on specific details from complex data.