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.
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 /??
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.
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.
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.