Complete the code to get all users from Active Directory.
Get-ADUser [1]The -Filter * parameter tells Get-ADUser to retrieve all users.
Complete the code to get a user with the username 'jdoe'.
Get-ADUser -Identity [1]The -Identity parameter accepts the username or distinguished name. Here, 'jdoe' is the username.
Fix the error in the code to get users with the last name 'Smith'.
Get-ADUser -Filter "[1]"
The correct property for last name in Get-ADUser filter is Surname.
Fill both blanks to get users whose account is enabled and have 'Admin' in their title.
Get-ADUser -Filter "Enabled -eq [1] -and Title -like '[2]'"
To filter enabled accounts, use Enabled -eq True. To find titles containing 'Admin', use wildcard *Admin* with -like.
Fill all three blanks to create a dictionary of usernames and their email addresses for users in the 'Sales' department.
$users = Get-ADUser -Filter "Department -eq '[1]'" -Properties [2] $userEmails = @{ } [3]
Filter users by department 'Sales'. Request the 'EmailAddress' property. Then build a dictionary mapping usernames (SamAccountName) to emails.