How to search based on custom attribute?
Hope this helps:
PS C:> ipmo activedirectory
PS C:> New-PSDrive -Name charlotte -PSProvider activedirectory -Root "AD:\ou=charlotte,dc=iammred,dc=net"
PS charlotte:> get-item -Path "cn=ed wilson" -Properties *
This will give all properties of a user. If you are looking at a list of users, I guess you could save the list of users in a variable and loop them using a for loop.
graham
Updated on September 18, 2022Comments
-
graham over 1 year
I have a custom attribute in AD similar to an employee ID. I can use get-aduser and pull the information from this field by filter, but I cannot search a user based on that attribute. The search returns no results.
For instance:
get-aduser -filter {customattribute -like '34356'}
returns nothing, but if I get-aduser -properties * -filter {customattribute -like *}
the user with that attribute comes up in the list of all users.