######
param($entry)
$server = "<serverName>"
$path = "o=<orgName>"
$DN = "LDAP://$server/$path"
$auth = [System.DirectoryServices.AuthenticationTypes]::Anonymous
$de = New-Object
System.DirectoryServices.DirectoryEntry($DN,$null,$null,$auth)
$filter = "(mail=$($entry))"
$ds = New-Object
system.DirectoryServices.DirectorySearcher($de,$filter,$null)
$query = $ds.FindAll()
######
If I run this I get:
Exception calling "FindAll" with "0" argument(s): "Unknown error
(0x80005000)"
At E:\scripts\test.ps1:17 char:21
+ $query = $ds.FindAll( <<<< )
If I change the baseDN to be "ou=people,o=<orgName>" it works fine if
I'm searching for an object that is in that OU, however many of my
queries could be for objects outside of that container. If I perform an
LDAP query using ldp using the baseDN I originally started with (at the
top) it works fine. I looked at the search scope and it defaults to
subTree, which I'd think would allow this to work. Anyone know what I
might be missing?