Bird
0
0

Why does Get-Member sometimes show different members for the same command output when run in different contexts?

hard📝 Conceptual Q10 of 15
PowerShell - Cmdlets and Pipeline
Why does Get-Member sometimes show different members for the same command output when run in different contexts?
ABecause Get-Member caches results and shows old data
BBecause Get-Member only shows members for built-in objects
CBecause the object type can change depending on how the command is run
DBecause PowerShell randomly changes object members
Step-by-Step Solution
Solution:
  1. Step 1: Understand object types in PowerShell

    Commands can output different object types depending on parameters or environment.
  2. Step 2: Effect on Get-Member output

    Get-Member shows members of the actual object type received, so output varies with object type.
  3. Final Answer:

    Because the object type can change depending on how the command is run -> Option C
  4. Quick Check:

    Object type affects Get-Member output [OK]
Quick Trick: Object type changes cause different Get-Member results [OK]
Common Mistakes:
  • Assuming Get-Member caches results
  • Thinking it only works on built-in objects
  • Believing PowerShell changes members randomly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes