LDAP Binding with host and different x500 spec

David Zemdegs 1,586 Reputation points

I have to do an LDAP search and all I have been given is the FQDN host name and the search root in the format OU=xxx,O=yyy,c=zz.

Does anyone know how to construct the directory entry using both of those?
David z

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
5,962 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,397 questions
0 comments No comments
{count} votes

Accepted answer
  1. David Zemdegs 1,586 Reputation points

    Its OK Ive worked it out:
    $Directory = New-Object DirectoryServices.DirectoryEntry("LDAP://<hostname>/<x500searchroot>","<x500account>","<password>")
    $searcher = New-Object System.DirectoryServices.DirectorySearcher
    $searcher.SearchRoot = $Directory

0 additional answers

Sort by: Most helpful