Bird
0
0

You want to automate running a script on a remote computer but also interact if needed. How can you combine Enter-PSSession with script execution?

hard📝 Application Q9 of 15
PowerShell - Remote Management
You want to automate running a script on a remote computer but also interact if needed. How can you combine Enter-PSSession with script execution?
ACopy the script locally and run Enter-PSSession without script
BUse Enter-PSSession with -FilePath to run the script automatically
CStart Enter-PSSession, then run the script manually inside the session
DUse Invoke-Command instead of Enter-PSSession for automation
Step-by-Step Solution
Solution:
  1. Step 1: Understand Enter-PSSession's role

    Enter-PSSession creates an interactive session but does not run scripts automatically.
  2. Step 2: Combine manual script execution

    Start the session, then run the script manually inside for interaction.
  3. Final Answer:

    Start Enter-PSSession, then run the script manually inside the session -> Option C
  4. Quick Check:

    Enter-PSSession = interactive; run scripts manually [OK]
Quick Trick: Run scripts manually inside Enter-PSSession session [OK]
Common Mistakes:
  • Expecting -FilePath to run scripts automatically
  • Using Invoke-Command when interaction is needed
  • Copying script without running it

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes