0
0
PowerShellscripting~10 mins

Get-Member for object inspection in PowerShell - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to list all properties and methods of the object stored in $obj.

PowerShell
$obj | [1]
Drag options to blanks, or click blank then click option'
AGet-Member
BSelect-Object
CFormat-Table
DGet-Content
Attempts:
3 left
💡 Hint
Common Mistakes
Using Get-Content which reads file content, not object members.
Using Select-Object which selects properties but doesn't list all members.
2fill in blank
medium

Complete the code to show only the methods of the object $item.

PowerShell
$item | Get-Member -MemberType [1]
Drag options to blanks, or click blank then click option'
AProperty
BMethod
CEvents
DAliasProperty
Attempts:
3 left
💡 Hint
Common Mistakes
Using Property which shows data fields, not actions.
Using Events which shows event handlers, not methods.
3fill in blank
hard

Fix the error in the code to correctly get the properties of $data.

PowerShell
$data | Get-Member -MemberType [1]
Drag options to blanks, or click blank then click option'
Amethods
BProps
Cproperty
DProperty
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural forms like 'methods' or 'properties' which cause errors.
Using incorrect member type names like 'Props'.
4fill in blank
hard

Fill both blanks to list only the properties of $record and display their names.

PowerShell
$record | Get-Member -MemberType [1] | Select-Object [2]
Drag options to blanks, or click blank then click option'
AProperty
BMethod
CName
DValue
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting 'Value' instead of 'Name' which does not exist in this context.
Filtering by 'Method' instead of 'Property'.
5fill in blank
hard

Fill all three blanks to get methods of $obj that start with 'Get' and select their names.

PowerShell
$obj | Get-Member -MemberType [1] | Where-Object { $_.Name -like '[2]' } | Select-Object [3]
Drag options to blanks, or click blank then click option'
AMethod
BGet*
CName
DProperty
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Property' instead of 'Method' in the first blank.
Using incorrect wildcard patterns or missing quotes.
Selecting 'Property' instead of 'Name' in the last blank.