Find a value in any property in AD

5/5 - (4 votes)

A few days ago, I was trying to find all instances of a value stored in AD.  I was trying to understand all of the places that a particular partial GUID value was being used. so I had to come up with a way to search all properties for all objects across the directory space.

[string]$value = "whatever"
([adsisearcher]'cn=*').FindAll() | % { If ($_.Properties.Values | ? { $_ -match $value}) { $_ }}

Happy searching!