Challenge - 5 Problems
PowerShell Group-Object Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Output of Group-Object by Property
What is the output of this PowerShell command grouping processes by their ProcessName property?
PowerShell
Get-Process | Group-Object -Property ProcessName | Select-Object -First 3 | Format-Table Name,Count -AutoSizeAttempts:
2 left
💡 Hint
Think about how many instances of each process are typically running and how Group-Object counts them.
✗ Incorrect
Group-Object groups items by the specified property and counts how many items fall into each group. The output shows the process name and how many instances are running.
🧠 Conceptual
intermediate1:30remaining
Understanding Group-Object Output Structure
Which property of the output objects from Group-Object contains the list of grouped items?
Attempts:
2 left
💡 Hint
Look for the property that holds the actual items grouped together.
✗ Incorrect
The 'Group' property contains the collection of items that belong to each group. 'Count' is the number of items, 'Name' is the group key.
📝 Syntax
advanced2:00remaining
Correct Syntax for Grouping by Multiple Properties
Which option correctly groups services by both Status and StartType properties?
Attempts:
2 left
💡 Hint
Remember how to pass multiple properties as an array in PowerShell.
✗ Incorrect
To group by multiple properties, you pass an array of property names using @('prop1', 'prop2').
🔧 Debug
advanced1:30remaining
Identify the Error in Group-Object Usage
What error will this command produce?
Get-Process | Group-Object -Property
PowerShell
Get-Process | Group-Object -Property
Attempts:
2 left
💡 Hint
Check if the required parameter is missing its value.
✗ Incorrect
The -Property parameter requires a value. Omitting it causes a ParameterBindingException.
🚀 Application
expert2:30remaining
Count Unique File Extensions in a Folder
You want to count how many files of each extension exist in a folder using PowerShell. Which command produces the correct output?
Attempts:
2 left
💡 Hint
Think about which property holds the file extension.
✗ Incorrect
The Extension property holds the file extension. Grouping by it counts files by type. Grouping by Name or FullName groups individual files, Length groups by size.