Results 1 to 11 of 11

Thread: csvde export, excluding specific OU's.

  1. #1
    Join Date
    Dec 2005
    Posts
    136

    csvde export, excluding specific OU's.

    I am working with a csvde to export all user accounts but I want to exclude some OUs. There is a problem with it and wanted to pass it out here for anyone that can correct me. I am working with -r (filter) and I am right now working it as:

    "(&(objectCategory=user)(!cn=*,ou=serviceaccounts,dc=company,dc=com))"
    or
    "(&(objectCategory=user)(!ou=serviceaccounts,dc=company,dc=com))" and other variants.

    The exclamation is to exclude or not from what I have read and seen in the examples as used for attributes of accounts to filter on. I am trying to get over and try joeware but wanted to check on the csvde syntax since I have a feeling that I am going to be asked for other things such as multiple OUs to exclude to certain attributes and then use them for import.

  2. #2
    Join Date
    Nov 2005
    Posts
    631
    Have you tried using the tool called ADManager Plus to export all the users except some of the OUs. Check out its demo from its official website by searching on the net.

  3. #3
    Join Date
    Feb 2007
    Posts
    5
    I am also trying to do the same thing, exclude certain OU's or only use the OU's that I have specified. This is what I have:

    CSVDE -d "OU=Users,OU=Information Technology,OU=Departments,DC=domain,DC=domain,dc=com" -f Export.csv -r objectCategory=person -l "cn, l, st, title, department, company, userPrincipalName"

    That only does 1 OU...

  4. #4
    Join Date
    Nov 2005
    Posts
    1,192

    Re: csvde export, excluding specific OU's.

    I guess that with pure LDAP, the only option left for you is to query each level individually, there cannot be another way to filter out specific subou's. Adfind has a filtering built into it via the -excldn switch, so you can download the same and check at adfind /??

  5. #5
    Join Date
    Feb 2007
    Posts
    5
    If I queried each OU individually, how would I get it to append to the same file?

  6. #6
    Join Date
    Sep 2005
    Posts
    1,372

    Re: csvde export, excluding specific OU's.

    I dont think you can do that with csvde, you will need to create separate files and then join them.

  7. #7
    Join Date
    Feb 2007
    Posts
    5
    I know...I have created the scripts to make the seperate files, I just need to know how to join the files through some type of script...and not an external program. I know there are programs out there that will join them, but I'm trying to make this all into one script. Right now I'm using vbs.

  8. #8
    Join Date
    Oct 2005
    Posts
    449

    Re: csvde export, excluding specific OU's.

    You need to open an output file and after that get list of files to read. After that open file from to read list and read file. Now you can try to strip header line and if the first one right it to file, else validate that it is the same as first header file, that is nothing changed, and then write in file to out file and loop. You need to make sure that the attributes returned are the same as the headers can vary based on what is returned.

  9. #9
    Join Date
    Feb 2007
    Posts
    5
    To export users and contacts, would I just use:

    "(objectCategory=person)"

    ??

  10. #10
    Join Date
    Sep 2005
    Posts
    193

    Re: csvde export, excluding specific OU's.

    If you are using the filter with -r then it will work and give you users and contacts, but also computer accounts. You can use "(&(objectCategory=person)(!objectCategory=computer))" which will filter the results down to only users and contacts.

  11. #11
    Join Date
    Feb 2007
    Posts
    5
    Ok thanks. I have one more question...how would I get the fields to be exported in a certain order by columns in the csv file? I am having a horrible time trying to figure it out, it seems like its random in the way that it puts it in the csv. It is definitely not in the order that you list the fields...

Similar Threads

  1. What is the formula for Excel to add days excluding holidays
    By Krupanath in forum MS Office Support
    Replies: 2
    Last Post: 24-01-2012, 01:08 PM
  2. CSVDE code to export without DN attribute
    By LucasYew in forum Windows Software
    Replies: 4
    Last Post: 24-04-2009, 09:29 AM
  3. Gaming Rig for 800$ excluding monitor
    By adikumar2010 in forum Motherboard Processor & RAM
    Replies: 2
    Last Post: 22-04-2009, 12:09 AM
  4. Exporting member of a particular group using csvde
    By Graham in forum Active Directory
    Replies: 8
    Last Post: 27-03-2008, 06:01 PM
  5. Export Group membership using script\CSVDE
    By PK in forum Windows Server Help
    Replies: 3
    Last Post: 08-10-2007, 07:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •