Solved

CSVDE to export only active accounts

Posted on 2010-08-26
7
4,282 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
In-place Upgrading Dirsync to Azure AD Connect
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 …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

808 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