Query for user or users in Exchange online

Copper Contributor

I have a slightly different version of this posted elsewhere.  Can I, in Exchange online, run a query that will for example:

1. Give me all users with a specific company name-i.e. all users where company name matches xxx


2. Give me all users where company name matches xxx OR state=ny


I'm looking to construct some lists but it would be very helpful to just pull back, throw some queries out, get results and then fine tune from there.   I don't see (or haven't used the right terms) a way to do this from online KB articles

2 Replies
Most Exchange cmdlets support -Filter, so you can do it like:

Get-User -Filter {Company -eq "XXX"}

If the idea is to use this for DDGs, best use the Get-Recipient cmdlet and -RecipientPreviewFilter.
Thank you Vasil, I appreciate your help on both of them. Right now it's boolean 101 for me. Try a wide query see what I get and add things I know are there to confirm syntax.