Bird
0
0

You want to stop all services that have 'Print' in their name. Which script correctly does this?

hard📝 Application Q8 of 15
PowerShell - System Administration
You want to stop all services that have 'Print' in their name. Which script correctly does this?
AGet-Service | Where-Object {$_.Name -like '*Print*'} | Stop-Service
BStop-Service -Name '*Print*'
CGet-Service -Name '*Print*' -Force | Stop-Service
DStop-Service | Where-Object {$_.Name -like '*Print*'}
Step-by-Step Solution
Solution:
  1. Step 1: Filter services by name pattern

    Get-Service | Where-Object {$_.Name -like '*Print*'} selects services with 'Print' in their name.
  2. Step 2: Pipe filtered services to Stop-Service

    Piping the filtered services to Stop-Service stops them.
  3. Final Answer:

    Get-Service | Where-Object {$_.Name -like '*Print*'} | Stop-Service -> Option A
  4. Quick Check:

    Filter then pipe to Stop-Service = B [OK]
Quick Trick: Filter services first, then pipe to Stop-Service [OK]
Common Mistakes:
  • Using wildcard in -Name parameter directly
  • Trying to pipe Stop-Service before filtering
  • Assuming Stop-Service accepts wildcards in -Name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes