Bird
0
0

Which statement about Invoke-Command is TRUE regarding its behavior with script blocks and remote sessions?

hard📝 Conceptual Q10 of 15
PowerShell - Remote Management
Which statement about Invoke-Command is TRUE regarding its behavior with script blocks and remote sessions?
AVariables inside script blocks are evaluated on the local machine before sending
BInvoke-Command automatically transfers all local variables to the remote session
CScript blocks run in the remote session's scope and cannot access local variables unless passed explicitly
DScript blocks run locally and only send results to remote computers
Step-by-Step Solution
Solution:
  1. Step 1: Understand script block execution context

    Script blocks run remotely and have their own scope; local variables are not automatically available.
  2. Step 2: Confirm variable passing behavior

    Variables must be passed explicitly using ArgumentList or other methods.
  3. Final Answer:

    Script blocks run in the remote session's scope and cannot access local variables unless passed explicitly -> Option C
  4. Quick Check:

    Remote script blocks have isolated scope [OK]
Quick Trick: Remote script blocks need explicit variable passing [OK]
Common Mistakes:
  • Assuming local variables auto-transfer
  • Thinking script blocks run locally
  • Believing variables are evaluated before sending

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes