Bird
Raised Fist0
PowerShellscripting~20 mins

Get-Member for object inspection in PowerShell - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
PowerShell Object Inspector
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output type of Get-Member?
You run the command Get-Process | Get-Member. What type of information does Get-Member display?
PowerShell
Get-Process | Get-Member
AThe CPU usage percentage of each process
BThe memory usage of each process
CA list of properties and methods of the process objects
DThe full list of running processes with detailed info
Attempts:
2 left
💡 Hint
Think about what Get-Member does to objects piped into it.
💻 Command Output
intermediate
2:00remaining
What does this command output?
What is the output of this command?
'Hello World' | Get-Member
PowerShell
'Hello World' | Get-Member
AA list of all commands available in PowerShell
BThe string 'Hello World' printed again
CAn error saying Get-Member cannot process strings
DProperties and methods of the System.String object
Attempts:
2 left
💡 Hint
What type is a text string in PowerShell?
📝 Syntax
advanced
2:00remaining
Which command correctly shows only properties of an object?
You want to see only the properties of a service object. Which command is correct?
AGet-Service | Get-Member -MemberType Property
BGet-Service | Get-Member -Type Property
CGet-Service | Get-Member -Only Properties
DGet-Service | Get-Member -Member Properties
Attempts:
2 left
💡 Hint
Check the exact parameter name for filtering member types.
🔧 Debug
advanced
2:00remaining
Why does this command fail?
You run this command:
Get-Process | Get-Member -MemberType Methods
But it returns an error. Why?
PowerShell
Get-Process | Get-Member -MemberType Methods
ABecause the correct value is 'Method' not 'Methods'
BBecause Get-Member does not accept the -MemberType parameter
CBecause Get-Process does not output objects with methods
DBecause Get-Process must be run with admin rights
Attempts:
2 left
💡 Hint
Check the exact spelling of the parameter value.
🚀 Application
expert
3:00remaining
How to list only script methods of a custom object?
You have a custom object with script methods and properties. Which command lists only the script methods?
PowerShell
$obj = [PSCustomObject]@{Name='Test'; GetInfo={"Info"}}
A$obj | Get-Member -MemberType Method
B$obj | Get-Member -MemberType ScriptMethod
C$obj | Get-Member -MemberType ScriptProperty
D$obj | Get-Member -MemberType Property
Attempts:
2 left
💡 Hint
Script methods are different from normal methods and properties.

Practice

(1/5)
1. What is the main purpose of the Get-Member cmdlet in PowerShell?
easy
A. To execute a script block on an object
B. To list the properties and methods of an object
C. To delete an object from memory
D. To create a new object instance

Solution

  1. Step 1: Understand what Get-Member does

    Get-Member shows the properties and methods available on an object, helping you explore it.
  2. Step 2: Compare options with Get-Member purpose

    Options B, C, and D describe actions unrelated to inspecting object members.
  3. Final Answer:

    To list the properties and methods of an object -> Option B
  4. Quick Check:

    Get-Member = List properties and methods [OK]
Hint: Remember: Get-Member shows what an object has and can do [OK]
Common Mistakes:
  • Thinking Get-Member runs code on the object
  • Confusing Get-Member with object creation
  • Assuming it deletes or modifies objects
2. Which of the following is the correct syntax to use Get-Member to inspect the properties of the output from Get-Process?
easy
A. Get-Process | Get-Member
B. Get-Member | Get-Process
C. Get-Process Get-Member
D. Get-Process > Get-Member

Solution

  1. Step 1: Understand piping in PowerShell

    The pipe symbol | sends output from one command as input to another.
  2. Step 2: Apply piping to Get-Process and Get-Member

    Correct syntax is Get-Process | Get-Member to inspect process objects.
  3. Final Answer:

    Get-Process | Get-Member -> Option A
  4. Quick Check:

    Pipe output to Get-Member = Get-Process | Get-Member [OK]
Hint: Use pipe (|) to send output to Get-Member [OK]
Common Mistakes:
  • Reversing the order of commands
  • Using spaces instead of pipe
  • Trying to redirect output with >
3. What will be the output type when you run Get-Process | Get-Member -MemberType Property?
medium
A. List of properties of process objects
B. List of all processes running
C. List of methods of process objects
D. Error message about invalid syntax

Solution

  1. Step 1: Understand the -MemberType Property filter

    This filter limits output to only properties of the object, excluding methods.
  2. Step 2: Apply filter to Get-Process output

    The command lists only properties (like Id, ProcessName) of each process object.
  3. Final Answer:

    List of properties of process objects -> Option A
  4. Quick Check:

    MemberType Property = Properties listed [OK]
Hint: Use -MemberType Property to see only properties [OK]
Common Mistakes:
  • Confusing properties with methods
  • Expecting process list instead of members
  • Assuming syntax error due to filter
4. You run the command Get-Process | Get-Member -MemberType ScriptMethod but get no output. What is the most likely reason?
medium
A. The -MemberType parameter is misspelled
B. The pipeline is missing before Get-Member
C. The objects returned by Get-Process have no methods
D. You used the wrong parameter value for -MemberType

Solution

  1. Step 1: Check the -MemberType parameter value

    The correct value for methods is 'Method' (singular). Using a wrong value returns no results.
  2. Step 2: Verify other options

    Options A and B would cause errors, not empty output. The objects returned by Get-Process have methods, so The objects returned by Get-Process have no methods is false.
  3. Final Answer:

    You used the wrong parameter value for -MemberType -> Option D
  4. Quick Check:

    Wrong -MemberType value = no output [OK]
Hint: Check exact spelling of -MemberType values [OK]
Common Mistakes:
  • Using plural 'Methods' instead of 'Method'
  • Forgetting the pipe symbol
  • Assuming no methods exist on objects
5. You want to find only the properties of a service object that start with 'Status'. Which command correctly uses Get-Member to filter these properties?
hard
A. Get-Service | Get-Member -MemberType Property | Where-Object Name -like 'Status*'
B. Get-Service | Get-Member -MemberType Property Name 'Status*'
C. Get-Service | Get-Member -MemberType Property | Where-Object { $_.Name -like 'Status*' }
D. Get-Service | Get-Member -MemberType Property -Filter 'Status*'

Solution

  1. Step 1: Understand filtering with Get-Member

    Get-Member does not support a -Name or -Filter parameter for partial matches, so filtering must be done after.
  2. Step 2: Use Where-Object to filter properties by name

    Get-Service | Get-Member -MemberType Property | Where-Object { $_.Name -like 'Status*' } correctly pipes Get-Member output to Where-Object with a script block filtering names starting with 'Status'.
  3. Final Answer:

    Get-Service | Get-Member -MemberType Property | Where-Object { $_.Name -like 'Status*' } -> Option C
  4. Quick Check:

    Filter after Get-Member with Where-Object [OK]
Hint: Filter Get-Member output using Where-Object script block [OK]
Common Mistakes:
  • Trying to use -Name or -Filter with Get-Member
  • Using Where-Object without script block
  • Filtering before Get-Member instead of after
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard