Bird
0
0

You want to list all users in the 'Sales' department with their names and phone numbers. Which command will do this correctly?

hard📝 Application Q15 of 15
PowerShell - Active Directory
You want to list all users in the 'Sales' department with their names and phone numbers. Which command will do this correctly?
AGet-ADUser -Filter 'Department -like Sales' | Select Name, PhoneNumber
BGet-ADUser -Identity 'Sales' -Properties Phone | Select Name, Phone
CGet-ADUser -Filter 'Department = Sales' -Properties PhoneNumber | Select-Object Name, PhoneNumber
DGet-ADUser -Filter 'Department -eq "Sales"' -Properties TelephoneNumber | Select-Object Name, TelephoneNumber
Step-by-Step Solution
Solution:
  1. Step 1: Use correct filter syntax for department

    The filter Department -eq "Sales" correctly matches users in Sales department.
  2. Step 2: Include correct property and select output

    Use -Properties TelephoneNumber to get phone numbers, then select Name and TelephoneNumber for output.
  3. Step 3: Check other options for errors

    Get-ADUser -Identity 'Sales' -Properties Phone | Select Name, Phone uses -Identity incorrectly and wrong property names. Get-ADUser -Filter 'Department -like Sales' | Select Name, PhoneNumber has wrong filter syntax and property names. Get-ADUser -Filter 'Department = Sales' -Properties PhoneNumber | Select-Object Name, PhoneNumber uses '=' instead of '-eq' and wrong property names.
  4. Final Answer:

    Get-ADUser -Filter 'Department -eq "Sales"' -Properties TelephoneNumber | Select-Object Name, TelephoneNumber -> Option D
  5. Quick Check:

    Filter with -eq + correct property = Get-ADUser -Filter 'Department -eq "Sales"' -Properties TelephoneNumber | Select-Object Name, TelephoneNumber [OK]
Quick Trick: Use -Filter with -eq and add -Properties for extra fields [OK]
Common Mistakes:
  • Using wrong filter operators like '='
  • Wrong property names like Phone instead of TelephoneNumber
  • Misusing -Identity for filtering

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes