Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add users to AD groups, based on a csvde export

Status
Not open for further replies.

popewks

MIS
Sep 10, 2010
2
US
I need to import these users back into the groups, as i have a need to remove them from AD for another project.

I am able to export out the information i want using this csvde command:

csvde -d "OU=Dir Contacts,DC=testpope,dc=local" -f memberof.csv -r objectCategory=contact -l "memberof"

Here is the csv formating:

DN,memberOf
"CN=Test User1,OU=dir Contacts,DC=testpope,DC=local","CN=Test Group2,CN=Users,DC=testpope,DC=local;CN=Test,CN=Users,DC=testpope,DC=local"
"CN=Test User 2,OU=dir Contacts,DC=testpope,DC=local","CN=Test Group 2,CN=Users,DC=testpope,DC=local;CN=Test,CN=Users,DC=testpope,DC=local"

can anyone help me out here..i have over 3000 users and 300+ different groups.

Thanks for any help!!!!
 
Your CSV is going to be useless as is. You need to separate the user ID and its group memberships with a character other than a comma since the distinguishedName has commas in it.

I would approach this a little differently. I would enumerate the users and create a text file for each user. Within that text file I would put all their group memberships.

You would then be able to read a text file and add the user (based on file name) back into the groups.

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Could you suggest a method to obtain this information?
I need to pull all contacts from a specific OU..

i guess i am not following what you are saying would be the best method.
 
get yourself a copy of the Active Directory Cookbook. it is well worth the investment. Read through the examples and you will easily be able to accomplish the type of AD manips you are doing
 
looks like one could still use the "","" to do the delimiting
 
Are the contacts mail enabled? I don't know the full context of this project. Are you deleting the contacts and then recreating them or just disjoining from groups and joining back?

I hope that helps.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top