by yooakim at 2012-08-15 22:30:46
I’m working in an Environment where there are non-Microsoft LDAP servers. What is the recommended way of quering these?by JeffH at 2012-08-16 06:45:58
I’m using something like this:$server = ‘myserver.com:1234’
$path = ‘ou=Customers,o=myserver.com’
$DN = "LDAP://$server/$path"
$filter = ‘(objectClass=myClass)’
$auth = [System.DirectoryServices.AuthenticationTypes]::FastBind
$Domain = New-Object System.DirectoryServices.DirectoryEntry($DN,$user,$password,$auth)
$Searcher = New-Object System.DirectoryServices.DirectorySearcher
$Searcher.SearchRoot = $Domain
#$Searcher.PageSize = 1000
$Searcher.Filter = $Filter
$Searcher.SearchScope = ‘Subtree’
$Proplist = ‘name’, ‘description’
foreach ($i in $PropList){$Searcher.PropertiesToLoad.Add($i)}
$Results = $Searcher.FindAll()
Is this a "good" way to do it or are there better/easier ways? Being neither an expert in LDAP or PowerShell I could probably make this better!
/Joakim
That is a good a method as any as far as I’m concerned.by RichardSiddaway at 2012-08-17 08:44:08
I would agree with Jeffby queenw99 at 2012-10-15 08:00:35
if you are accessing non-Microsoft LDAP you need to specify the additional info
Joakim, wondering if you were able to get your script to work correctly? I’ve modified it slightly for my ldap directory but the filter and properties values aren’t being handled correctly. Thanks! Wes