Link to home
Start Free TrialLog in
Avatar of bnrtech
bnrtech

asked on

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)
Avatar of Mike Kline
Mike Kline
Flag of United States of America image

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
Avatar of bnrtech
bnrtech

ASKER

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.
Avatar of bnrtech

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of Mike Kline
Mike Kline
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bnrtech

ASKER

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.
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.