Solved

CSVDE to export only active accounts

Posted on 2010-08-26
7
4,040 Views
Last Modified: 2012-06-21
Got most of my CSVDE command syntax where I want it. Here is what I have so far...

CSVDE -d "OU=bcf,DC=somd,dc=com" -f aduser.csv

The one item I cannot figure out is how might I filter the output so it only includes 'active' users (in other words user accounts that are not disabled)
0
Comment
Question by:bnrtech
  • 3
  • 2
7 Comments
 
LVL 57

Expert Comment

by:Mike Kline
ID: 33535965
Does it have to be CSVDE?  If so you can do an LDAP filter in there. something like

(&(objectcategory=person)(objectclass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))

 What I really like is

adfind by Joe Richards

http://www.joeware.net/freetools/tools/adfind/index.htm

Enabled

adfind -default -bit -f "&(objectcategory=person)(objectclass=user)(!useraccountcontrol:AND:=2)" samaccountname givenname sn  -nodn -csv > c:\EnabledUsers.csv

That will give you a csv of enabled users on your C drive.  I only pulled a few attributes.

The Quest AD cmdlets are also great for this.

thanks

Mike
0
 

Author Comment

by:bnrtech
ID: 33536060
I will give the syntax you noted a try. Thanks.

We do have to stick with CSVDE because this site does not allow me to install any 3rd party utils.
0
 

Author Comment

by:bnrtech
ID: 33536086
So would the syntax go something like this...

CSVDE -d "OU=bcf,DC=somd,dc=com" -f (&(objectcategory=person)(objectclass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2)) aduser.csv

0
 
LVL 57

Accepted Solution

by:
Mike Kline earned 500 total points
ID: 33536129
oh with CSVDE it is the -r switch before the LDAP query

CSVDE -d "OU=bcf,DC=somd,dc=com" -r "(&(objectcategory=person)(objectclass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))" aduser.csv

More on -r http://www.computerperformance.co.uk/Logon/Logon_CSVDE_Export.htm

by the way some other common queries with useraccountcontrol  http://www.kreslavsky.com/2008/08/active-directory-saved-queries-templates.html

Thanks

Mike

0
 

Author Comment

by:bnrtech
ID: 33678491
sorry for the delay. i took a couple weeks of for vacation. getting back in to the swing of things and will test this out this coming week.
0
 
LVL 74

Expert Comment

by:Glen Knight
ID: 34689915
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Join & Write a Comment

Companies that have implemented Microsoft’s Active Directory need to ensure that the Active Directory is configured and operating properly. If there are issues found and not resolved, it eventually leads the components to fail or stop working and fi…
Resolve DNS query failed errors for Exchange
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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 …

747 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

13 Experts available now in Live!

Get 1:1 Help Now