Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4695
  • Last Modified:

CSVDE to export only active accounts

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
bnrtech
Asked:
bnrtech
  • 3
  • 2
1 Solution
 
Mike KlineCommented:
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
 
bnrtechAuthor Commented:
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
 
bnrtechAuthor Commented:
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
Mike KlineCommented:
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
 
bnrtechAuthor Commented:
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
 
Glen KnightCommented:
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

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now