Bird
0
0

What will be the output of this PowerShell command?

medium📝 Command Output Q4 of 15
PowerShell - System Administration
What will be the output of this PowerShell command?
Get-Process -Name explorer | Stop-Process -PassThru
AIt starts a new explorer process.
BIt lists all explorer processes without stopping them.
CIt throws an error because -PassThru is invalid here.
DIt stops the explorer process and outputs the stopped process object.
Step-by-Step Solution
Solution:
  1. Step 1: Understand Get-Process piped to Stop-Process

    Get-Process -Name explorer gets the explorer process object(s). Piping to Stop-Process stops them.
  2. Step 2: Role of -PassThru parameter

    -PassThru makes Stop-Process output the stopped process object instead of nothing.
  3. Final Answer:

    It stops the explorer process and outputs the stopped process object. -> Option D
  4. Quick Check:

    Stop-Process -PassThru outputs stopped process [OK]
Quick Trick: Use -PassThru to see stopped process info [OK]
Common Mistakes:
  • Thinking -PassThru lists processes without stopping
  • Assuming it starts processes
  • Believing -PassThru causes errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes