Bird
0
0

Which of the following is the correct syntax to remove a PSSession stored in variable $session?

easy📝 Syntax Q3 of 15
PowerShell - Remote Management
Which of the following is the correct syntax to remove a PSSession stored in variable $session?
ARemove-PSSession -Session $session
BRemove-PSSession $session
CRemove-PSSession -PSSession $session
DRemove-PSSession -Name $session
Step-by-Step Solution
Solution:
  1. Step 1: Understand Remove-PSSession syntax

    Remove-PSSession accepts session objects directly as positional arguments.
  2. Step 2: Identify correct parameter usage

    Passing $session directly works; -Session and -PSSession are not valid parameters, -Name expects a string.
  3. Final Answer:

    Remove-PSSession $session -> Option B
  4. Quick Check:

    Remove session by passing variable directly [OK]
Quick Trick: Pass session variable directly to Remove-PSSession [OK]
Common Mistakes:
  • Using invalid parameters like -Session or -PSSession
  • Passing session name instead of object
  • Using incorrect parameter names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes