Bird
0
0

This script throws an error:

medium📝 Debug Q7 of 15
PowerShell - Remote Management
This script throws an error:
$session = New-PSSession -ComputerName Server04
Enter-PSSession -Session $session.Id

Why?
ANew-PSSession syntax is wrong
BEnter-PSSession does not accept -Session parameter
CEnter-PSSession requires a session object, not an Id
DYou must remove session before entering it
Step-by-Step Solution
Solution:
  1. Step 1: Check Enter-PSSession parameter requirements

    Enter-PSSession expects a session object, not just an Id number.
  2. Step 2: Identify cause of error

    Passing $session.Id (integer) causes error; must pass $session object directly.
  3. Final Answer:

    Enter-PSSession requires a session object, not an Id -> Option C
  4. Quick Check:

    Enter-PSSession needs session object, not Id [OK]
Quick Trick: Pass session object to Enter-PSSession, not Id [OK]
Common Mistakes:
  • Passing session Id instead of object
  • Misusing Enter-PSSession parameters
  • Trying to remove session before entering

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes