Avatar of Jorge Ocampo
Jorge Ocampo
Flag for United States of America asked on

ADModify LDAP Query Help

Hi,

i am trying to search all users that do not contain a proxyaddress but seemed to be getting an invalid query error, any help would be appreciated.

(objectClass=user)(!(proxyAddresses:=*@DOMAINNAME.com)))
PowershellActive Directory* LDAP

Avatar of undefined
Last Comment
Kevin Stanush

8/22/2022 - Mon
Kevin Stanush

Try:

(&(objectCategory=user)(!proxyAddresses=*))

For a visual way to do this, try Hyena (www.systemtools.com).  It will let you do this interactively by just running a query, and then you can sort on the ProxyAddresses column.

Video on modifying AD queries is here:

https://www.youtube.com/watch?v=1ONAhKyB61g
Jorge Ocampo

ASKER
(&(objectCategory=user)(!proxyAddresses=*@DomainName.com))

also returning contacts :(
Kevin Stanush

Sorry, just replace objectcategory=user to objectclass=user.  If you have a huge AD environment, we can optimize it with objectcategory some, but its probably not worth it.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Jorge Ocampo

ASKER
that worked :) could we also include "and" contains(@DOMAINNAME2)

summary

Must be user
Does not contain
3*filter Contains"@Domainname2.com"
ASKER CERTIFIED SOLUTION
Chris Dent

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Jorge Ocampo

ASKER
This Guy is A Wizard!
Kevin Stanush

Glad I could help.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.