Solved

CSVDE to export only active accounts

Posted on 2010-08-26
7
4,116 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

[b]Ok so now I will show you how to add a user name to the description at login. [/b] First connect to your DC (Domain Controller / Active Directory Server) SET PERMISSIONS FOR SCRIPT TO UPDATE COMPUTER DESCRIPTION TO USERNAME 1. Open Active …
Learn about cloud computing and its benefits for small business owners.
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 …

932 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

12 Experts available now in Live!

Get 1:1 Help Now