0
0
PowerShellscripting~20 mins

Select-Object for properties in PowerShell - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Select-Object Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this PowerShell command?
Given the following command, what will be the output?
PowerShell
Get-Process | Select-Object -Property Name, Id | Select-Object -First 3
A
[
  {"Name": "powershell"},
  {"Name": "explorer"},
  {"Name": "notepad"}
]
B
[
  {"Name": "powershell", "Id": 1234, "Handles": 200},
  {"Name": "explorer", "Id": 5678, "Handles": 150},
  {"Name": "notepad", "Id": 9101, "Handles": 50}
]
CError: Property 'Id' not found
D
[
  {"Name": "powershell", "Id": 1234},
  {"Name": "explorer", "Id": 5678},
  {"Name": "notepad", "Id": 9101}
]
Attempts:
2 left
💡 Hint
Select-Object limits the properties shown. The command selects only Name and Id properties.
💻 Command Output
intermediate
2:00remaining
What does this command output?
What is the output of this PowerShell command?
PowerShell
Get-Service | Select-Object -Property Status, Name | Select-Object -Last 2
A
[
  {"Status": "Running", "Name": "wuauserv"},
  {"Status": "Stopped", "Name": "WinDefend"}
]
B
[
  {"Name": "wuauserv"},
  {"Name": "WinDefend"}
]
C
[
  {"Status": "Running"},
  {"Status": "Stopped"}
]
DError: Property 'Status' not found
Attempts:
2 left
💡 Hint
Select-Object picks only the specified properties. The last 2 services are shown.
📝 Syntax
advanced
2:00remaining
Which option correctly selects the 'Name' and 'CPU' properties from processes?
Choose the correct PowerShell command to select only the 'Name' and 'CPU' properties from all processes.
AGet-Process | Select-Object Name, CPU
BGet-Process | Select-Object -Properties Name CPU
CGet-Process | Select-Object -Property Name, CPU
DGet-Process | Select-Object -Property "Name", "CPU"
Attempts:
2 left
💡 Hint
The correct parameter name is '-Property' and properties are comma-separated.
🔧 Debug
advanced
2:00remaining
Why does this command fail?
This command throws an error. What is the cause? Get-Process | Select-Object -Property Name, CpuTime
AMissing comma between property names.
BProperty 'CpuTime' does not exist on process objects.
CSelect-Object does not accept multiple properties.
DGet-Process command is invalid.
Attempts:
2 left
💡 Hint
Check if 'CpuTime' is a valid property of process objects.
🚀 Application
expert
2:00remaining
How many properties will the output objects have?
Consider this command: Get-ChildItem | Select-Object -Property Name, Length, @{Name='SizeKB';Expression={$_.Length / 1KB}} | Select-Object -First 5 How many properties does each output object have?
A3
B4
C1
D2
Attempts:
2 left
💡 Hint
Custom properties added with hashtables count as one property each.