Bird
0
0

What will be the output of this PowerShell command?

medium📝 Command Output Q13 of 15
PowerShell - Active Directory
What will be the output of this PowerShell command?
Get-ADOrganizationalUnit -Filter 'Name -like "HR*"' | Select-Object Name
ALists all OUs with names exactly 'HR*'
BLists all OUs with names containing 'HR' anywhere
CLists all OUs with names starting with 'HR'
DReturns an error due to incorrect filter syntax
Step-by-Step Solution
Solution:
  1. Step 1: Understand the filter syntax

    The filter 'Name -like "HR*"' matches OU names starting with 'HR'. The asterisk (*) is a wildcard for any characters after 'HR'.
  2. Step 2: Analyze the command output

    The command gets OUs matching the filter and selects only their Name property, so it lists names starting with 'HR'.
  3. Final Answer:

    Lists all OUs with names starting with 'HR' -> Option C
  4. Quick Check:

    Filter 'HR*' = names starting with HR [OK]
Quick Trick: '-like "HR*"' means names starting with HR [OK]
Common Mistakes:
  • Thinking it matches names containing 'HR' anywhere
  • Assuming exact match with 'HR*'
  • Believing the command causes an error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes