title: openldap in bash - get group member's by sAMAccountName?
body: <p>I have been using a command similar to the following to query for group membership:</p>
  
  <pre><code>ldapsearch -H ldap://999.999.999.99\
  -LLL -D \
  "CN=BindCN,OU=Group,OU=Functional,OU=Users,DC=domain,DC=com" \
  -x -w password \
  -b "OU=GroupName,OU=Shares,DC=domain,DC=com" \
  "cn=groupCN" \
  -s sub member
  </code></pre>
  
  <p>This will list all members of the group by DN:</p>
  
  <pre><code>member;range=0-1499: CN=Last\, First (F),OU=Employees,OU=Users
   ,DC=domain,DC=com
  member;range=0-1499: CN=Last\, First (F),OU=Employees,OU=Users
   ,DC=domain,DC=com
  member;range=0-1499: CN=Last\, First (F),OU=Employees,OU=Users
   ,DC=domain,DC=com
  ...
  </code></pre>
  
  <p>Which is alright, but say that I have a list of sAMAccountName's that is 5000 lines, and I want to see if any are in the above group (which has 5000 members.) Is there any way for me to query group members by sAMAccountName?</p>