Recall & Review
beginner
What does the <code>Select-Object</code> cmdlet do in PowerShell?It selects specific properties of an object or set of objects, allowing you to focus on only the data you need.
Click to reveal answer
beginner
How do you select only the
Name and Length properties from a list of files using Select-Object?Use
Get-ChildItem | Select-Object Name, Length. This shows just the file names and their sizes.Click to reveal answer
beginner
What happens if you use
Select-Object without specifying any properties?It returns the whole object with all its properties unchanged.
Click to reveal answer
intermediate
Can
Select-Object create new calculated properties? How?Yes. You can use a hashtable with
Name and Expression keys to define a new property based on existing data.Click to reveal answer
beginner
Why is
Select-Object useful when working with large data sets?It helps reduce clutter by showing only the important properties, making output easier to read and process.
Click to reveal answer
Which command selects only the
ProcessName and Id properties from running processes?✗ Incorrect
Select-Object is used to pick specific properties. Where-Object filters objects, Sort-Object sorts, and Format-Table formats output but does not select properties.
What will
Get-ChildItem | Select-Object -First 3 do?✗ Incorrect
The -First parameter selects the first 3 objects (files) from the list, not properties.
How do you add a new property called
SizeKB that shows file size in kilobytes using Select-Object?✗ Incorrect
Using a hashtable with Name and Expression keys creates a calculated property. 1KB is a PowerShell constant for 1024.
If you want to see all properties of an object, what should you do?
✗ Incorrect
Select-Object * selects all properties explicitly. Format-List * formats all properties for display, and Get-Member lists properties but does not show values.
What is the main benefit of using
Select-Object in scripts?✗ Incorrect
Select-Object helps focus output on specific properties, making data easier to read and use.
Explain how to use
Select-Object to show only certain properties from a list of files.Think about how you pick only the details you want from a big list.
You got /4 concepts.
Describe how to create a new calculated property using
Select-Object and why it might be useful.Imagine adding a new column based on existing data.
You got /4 concepts.