![]() ![]() $qry.SearchRoot = 'LDAP://OU=Laptops,OU=Computers,DC=contoso,DC=com'īut ADSI is originally a COM+ API that predates PowerShell and even. ![]() $qry.Filter = '(&(objectCategory=person)(anr=Stack))' More verbose example copied from some-or-other MSDN docs page (in AD, searching for the anr pseudo-attribute is how GUI tools resolve names): $qry = New-Object DirectoryServices.DirectorySearcher The type (aliased to ) represents an LDAP search query which can be used to find your user DN if you don't already know it: $qry = "(sAMAccountName=stackprotector)" (The LDAP:// part is case-sensitive this is an ADSI binding string, not a URL.) You don't need to specify a server – Windows will use the AD directory by default. The type (aliased to ) represents a specific entry – when given an LDAP object, its attributes directly correspond to the LDAP entry's attributes: $obj = "LDAP://CN=foo,OU=bar,DC=example,DC=com" PowerShell has access to ADSI via System.DirectoryServices types: ![]() Windows has the ADSI interface available to programs, which supports general LDAP access. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |