Francoisbouchard
asked on
ADfind query
Hello,
I'm trying to construct a statement to query Active Directory. Currently, my query returns all active user's information and outputs it as a CSV. What I want to do is also get contacts out of AD in the same query (if possible). As a test, I just tried changing the objectclass to "contact" (which I believe is the right class) but it returned nothing. My current statement is as follows:
adfind -default -bit -f "&(objectcategory=person)( objectclas s=user)(us eraccountc ontrol=*)( !(useracco untcontrol :AND:=2))" displayname givenname sn initials title department physicalDeliveryOfficeName company manager telephoneNumber mobile facsimileTelephoneNumber homephone pager ipphone mail wWWHomePage streetAddress postOfficeBox l st co postalCode -list -nodn -csv . >exports.csv
Any and all help is appreciated!
Thank you,
- Jeff Miller
EDIT:
I should have mentioned that I am using joeware's freeware tool "ADFind.exe". It's at http://www.joeware.net/freetools/tools/adfind/index.htm.
I'm trying to construct a statement to query Active Directory. Currently, my query returns all active user's information and outputs it as a CSV. What I want to do is also get contacts out of AD in the same query (if possible). As a test, I just tried changing the objectclass to "contact" (which I believe is the right class) but it returned nothing. My current statement is as follows:
adfind -default -bit -f "&(objectcategory=person)(
Any and all help is appreciated!
Thank you,
- Jeff Miller
EDIT:
I should have mentioned that I am using joeware's freeware tool "ADFind.exe". It's at http://www.joeware.net/freetools/tools/adfind/index.htm.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much! The query works perfectly and is actually quite fast. I'm pulling about 360 entries with this with no problem. I will definitely keep the separate query in mind for when our network becomes bigger. Thanks again!
Hey Jeff :)
You're absolutely right about the objectClass, but Contacts don't have userAccountControl so &(userAccountControl=*) will be filtering them out. That doesn't really leave much in the filter as you only have the objectClass test :)
HTH
Chris