LDIFDE from a file (CSV/TXT)

Posted on 2011-05-09
Last Modified: 2012-05-11
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.
Question by:Islandr
    LVL 15

    Accepted 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

    Author Closing Comment

    I apologized for taking so long.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
    "Migrate" an SMTP relay receive connector to a new server using info from an old server.
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
    This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now