Challenge - 5 Problems
Select-Object Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2: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 3Attempts:
2 left
💡 Hint
Select-Object limits the properties shown. The command selects only Name and Id properties.
✗ Incorrect
The command gets all processes, selects only the Name and Id properties, then shows the first 3. So output objects have only Name and Id.
💻 Command Output
intermediate2: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 2Attempts:
2 left
💡 Hint
Select-Object picks only the specified properties. The last 2 services are shown.
✗ Incorrect
The command gets all services, selects only Status and Name properties, then outputs the last 2 services with those properties.
📝 Syntax
advanced2: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.
Attempts:
2 left
💡 Hint
The correct parameter name is '-Property' and properties are comma-separated.
✗ Incorrect
Option C uses the correct parameter '-Property' with comma-separated property names. Option C misses the parameter name. Option C uses wrong parameter '-Properties'. Option C quotes properties incorrectly.
🔧 Debug
advanced2:00remaining
Why does this command fail?
This command throws an error. What is the cause?
Get-Process | Select-Object -Property Name, CpuTime
Attempts:
2 left
💡 Hint
Check if 'CpuTime' is a valid property of process objects.
✗ Incorrect
'CpuTime' is not a valid property of process objects. The correct property is 'CPU'. This causes the error.
🚀 Application
expert2: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?
Attempts:
2 left
💡 Hint
Custom properties added with hashtables count as one property each.
✗ Incorrect
The command selects Name, Length, and a custom property SizeKB. So each object has exactly 3 properties.