LDAP root query syntax to search more than one specific OU

You can!!! In short use this as the connection string: ldap://<host>:3268/DC=<my>,DC=<domain>?cn together with your search filter, e.g. (&(sAMAccountName={0})(&((objectCategory=person)(objectclass=user)(mail=*)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(memberOf:1.2.840.113556.1.4.1941:=CN=<some-special-nested-group>,OU=<ou3>,OU=<ou2>,OU=<ou1>,DC=<dc3>,DC=<dc2>,DC=<dc1>)))) That will search in the so called Global Catalog, that had been available out-of-the-box in our environment. Instead of the known/common other versions (or combinations thereof) that did NOT work in our environment with multiple OUs: ldap://<host>/DC=<my>,DC=<domain> … Read more

Querying Windows Active Directory server using ldapsearch from command line

The short answer is “yes”. A sample ldapsearch command to query an Active Directory server is: ldapsearch \ -x -h ldapserver.mydomain.example \ -D “mywindowsuser@mydomain.example” \ -W \ -b “cn=users,dc=mydomain,dc=com” \ -s sub “(cn=*)” cn mail sn This would connect to an AD server at hostname ldapserver.mydomain.example as user mywindowsuser@domain.example, prompt for the password on the … Read more

Query to list all users of a certain group

memberOf (in AD) is stored as a list of distinguishedNames. Your filter needs to be something like: (&(objectCategory=user)(memberOf=cn=MyCustomGroup,ou=ouOfGroup,dc=subdomain,dc=domain,dc=com)) If you don’t yet have the distinguished name, you can search for it with: (&(objectCategory=group)(cn=myCustomGroup)) and return the attribute distinguishedName. Case may matter.

How to keep the shell window open after running a PowerShell script?

You basically have 3 options to prevent the PowerShell Console window from closing, that I describe in more detail on my blog post. One-time Fix: Run your script from the PowerShell Console, or launch the PowerShell process using the -NoExit switch. e.g. PowerShell -NoExit “C:\SomeFolder\SomeScript.ps1” Per-script Fix: Add a prompt for input to the end … Read more

What are the differences between LDAP and Active Directory?

Active Directory is a database based system that provides authentication, directory, policy, and other services in a Windows environment LDAP (Lightweight Directory Access Protocol) is an application protocol for querying and modifying items in directory service providers like Active Directory, which supports a form of LDAP. Short answer: AD is a directory services database, and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)