• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1109
  • Last Modified:

LDIFDE from a file (CSV/TXT)

Hi there,

I need to generate a .ldf file from a list of user on another files with the following attributes:
ldifde -f users-groupname.ldf -r "(memberOf=CN=user-sgroup-,OU=OUgroup,OU=Groups,DC=holadz1,DC=combdomain,DC=com)" -l "cn,sn,givenname,displayname,displayName,userCertificate"

So let me explain better, I have an OU with members, but I do not need all the member from the OU, just the ones that I have on a list (file) LDIFDE generates a file base on the Attributes requested from an OU, but I do not need all the member from the OU, all that I need is the one from a list.  I am looking for a script to run this query.
1 Solution

I would recommend you change the ldifde synatax to look for a specific username and create a separate file for each user then combine the files together using type.

in order to get the individual files you could use a foreach loop in dos or create the syntax lines in excel (my favorite method ) , put usernames in column A and create the syntax in  B  . Would need to change the " to another character and use replace in notepad before pasting info dos window or batch file.  
B2 would look like
="ldifde -f "&A2&"-ldapuser.txt"& -r #(&(memberOf=CN=user-sgroup-,OU=OUgroup,OU=Groups,DC=holadz1,DC=combdomain,DC=com)(samaccountname"&A2&"))#


type *-ldap-user.txt > allusers-ldap-report.ldf
IslandrAuthor Commented:
I apologized for taking so long.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now