Bird
0
0

You want to find all commands of type 'Cmdlet' that include 'Service' in their name. Which command will correctly do this?

hard📝 Application Q15 of 15
PowerShell - Basics and Environment
You want to find all commands of type 'Cmdlet' that include 'Service' in their name. Which command will correctly do this?
AGet-Command -CommandType Cmdlet -Module '*Service*'
BGet-Command -Name '*Service*' -CommandType Cmdlet
CGet-Command -Name 'Service' -CommandType Cmdlet
DGet-Command -Filter '*Service*' -Type Cmdlet
Step-by-Step Solution
Solution:
  1. Step 1: Use correct parameters for filtering

    -Name '*Service*' uses wildcard to find commands with 'Service' anywhere in the name. -CommandType Cmdlet filters to only cmdlets.
  2. Step 2: Eliminate incorrect options

    -Filter and -Type are invalid parameters. Exact name 'Service' won't match commands containing 'Service' as part of the name. -Module '*Service*' filters by module name, not command name.
  3. Final Answer:

    Get-Command -Name '*Service*' -CommandType Cmdlet -> Option B
  4. Quick Check:

    Use -Name with wildcard and -CommandType = D [OK]
Quick Trick: Combine -Name with wildcard and -CommandType to filter commands [OK]
Common Mistakes:
  • Using invalid parameters like -Filter or -Type
  • Not using wildcards to match partial names
  • Confusing module filtering with command name filtering

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes