Querying non-MIcrosoft LDAP servers?

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 3 months ago.

  • Author
    Posts
  • #6162

    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?

    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

    by JeffH at 2012-08-16 06:45:58

    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 Jeff

    if you are accessing non-Microsoft LDAP you need to specify the additional info

    by queenw99 at 2012-10-15 08:00:35

    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

You must be logged in to reply to this topic.