Pages

Thursday, 30 May 2019

Windows Active Directory step by step (2) ------ how to use 'ldapsearch' to search Active Directory

Windows Active Directory complies with the LDAP protocol, so any LDAP client can connect and operate on it.

'ldapsearch' is one of the powerful tools provided by OpenLDAP. We will use it to explore more about Windows AD.

ldapsearch -H ldap://DCServer \
-x -D 'username@domain.name' \
-w 'password' \
-b 'dc=domain,dc=com' \
-z 3 \
'(filter)' 'atrributes' 

e.g.

Windows DC server: 192.168.0.11
The command was run on CentOS 7 with OpenLDAP tools installed.

root@cf-31:/# ldapsearch -H ldap://192.168.0.11 \
-x -D 'Administrator@smallstrong.org' -w '****' \
-b 'dc=smallstrong,dc=org' \
-z 3 \
'(objectClass=user)' \
'cn' \
| grep ^cn

cn: Administrator
cn: Guest
cn: DefaultAccount

No comments:

Post a Comment