Finding indexed attributes in Active Directory

Hello,

To find indexed attributed, you need to open the schema management console, and see the properties of the attributes :

PAS-GC-SamAccountName

As you can see, there is a case ticked named “Index this attribute”, that means this attribute is indexed.

You can repeat that operations on all attributes, or you can use this :

#Indexed Attributes
$dse = [adsi]“LDAP://RootDSE”
$SchemaPart=$dse.schemaNamingContext
$InexedAttSearcher=[ADSISearcher]"(searchFlags:1.2.840.113556.1.4.803:=1)"
$InexedAttSearcher.SearchRoot=[adsi]"LDAP://$SchemaPart"
$InexedAttSearcher.FindAll() | Select-Object -ExpandProperty Path | % {($_ -split ",")[0]} | % {($_ -split "=")[1]} | Sort-Object

 

0 thoughts on “Finding indexed attributes in Active Directory

  1. Here is an alternative last line to your script. The benefit is it shows the attribute names you see in ADUC versus the hyphenated ones.

    ($InexedAttSearcher.FindAll() | Select-Object -ExpandProperty Properties).ldapdisplayname | sort

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.