This is what I've been using to filter by city and it works flawlessly
>> Get-ADObject -LDAPFilter "(l=*Australia*)" |
>> Where { $_.ObjectClass -eq 'user' } |
>> Get-ADUser -Properties Title, Department, DistinguishedName, DisplayName, Manager, enabled, Description, EmailAddres
s, LastLogonDate |
>> Select Name, DisplayName, EmailAddress, Title, Department, Description, DistinguishedName, Manager, enabled, LastLogonDate |
>> Export-CSV -Path D:\result.csv -NoTypeInformation
However, when I switch city (l) to country (co), I get AD accounts in my csv file that don't even have countries, which is pretty bizarre. What am I missing?
Read more here: https://stackoverflow.com/questions/66272314/get-adobject-ldapfilter-country-string-not-working
Content Attribution
This content was originally published by Jack at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.