[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

LDIFDE from a file (CSV/TXT)

Posted on 2011-05-09
2
Medium Priority
?
1,100 Views
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.
0
Comment
Question by:Islandr
2 Comments
 
LVL 15

Accepted Solution

by:
markpalinux earned 2000 total points
ID: 35734657

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&"))#



user1-ldap-user.txt
user2-ldap-user.txt
user3-ldap-user.txt

type *-ldap-user.txt > allusers-ldap-report.ldf
0
 

Author Closing Comment

by:Islandr
ID: 35834097
I apologized for taking so long.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
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 …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

834 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