Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CSVDE to export only active accounts

Posted on 2010-08-26
7
Medium Priority
?
4,593 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Problems using Powershell and Active Directory?

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

 
LVL 57

Accepted Solution

by:
Mike Kline earned 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
A bad practice commonly found during an account life cycle is to set its password to an initial, insecure password. The Password Reset Tool was developed to make the password reset process easier and more secure.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

705 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