How to search based on custom attribute?

5,282

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.

http://blogs.technet.com/b/heyscriptingguy/archive/2013/03/20/use-powershell-to-find-non-default-user-properties-in-ad.aspx

Share:
5,282
graham
Author by

graham

Updated on September 18, 2022

Comments

  • graham
    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.