LDAP Binding with host and different x500 spec

David Zemdegs 1,586 Reputation points
2020-12-08T22:04:52.767+00:00

Greetings,
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?
Thanks
David z

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,244 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,464 questions
0 comments No comments
{count} votes

Accepted answer
  1. David Zemdegs 1,586 Reputation points
    2020-12-09T00:18:52.313+00:00

    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