Bird
0
0

You want to list all cmdlets and functions that include 'Service' in their name from the 'Microsoft.PowerShell.Management' module. Which command achieves this?

hard📝 Application Q8 of 15
PowerShell - Basics and Environment
You want to list all cmdlets and functions that include 'Service' in their name from the 'Microsoft.PowerShell.Management' module. Which command achieves this?
AGet-Command -Module Microsoft.PowerShell.Management -CommandType Alias
BGet-Command -Name '*Service*' -CommandType Cmdlet,Function
CGet-Command -Module Microsoft.PowerShell.Management -Name '*Service*' -CommandType Cmdlet,Function
DGet-Command -Module Microsoft.PowerShell.Management -Name 'Service*'
Step-by-Step Solution
Solution:
  1. Step 1: Filter by module and name pattern

    Use -Module to specify the module and -Name '*Service*' to match any command containing 'Service'.
  2. Step 2: Filter by command types

    Specify -CommandType Cmdlet,Function to include both cmdlets and functions.
  3. Step 3: Verify other options

    The command using only -Name '*Service*' and -CommandType Cmdlet,Function misses the module filter. The command using -CommandType Alias filters only aliases. The command with -Name 'Service*' matches only names starting with 'Service'.
  4. Final Answer:

    Get-Command -Module Microsoft.PowerShell.Management -Name '*Service*' -CommandType Cmdlet,Function -> Option C
  5. Quick Check:

    Combine -Module, -Name with wildcards, and -CommandType [OK]
Quick Trick: Combine -Module, -Name with wildcards, and -CommandType filters [OK]
Common Mistakes:
  • Omitting module filter
  • Using wrong CommandType
  • Wrong wildcard placement

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes