powershell syntax help - get-contact

Ben Hart
Ben Hart used Ask the Experts™
I've googled, i've checked techNet.. i cannot find a source for the correct syntax used with the -filter option.

Here's what I'm trying to do
get-contact -oganizationalunit 'ou' -filter WindowsEmailAddress =*@domain.com

Open in new window

I'm wanting to filter by the domain used in the external email address field for a bunch of contacts and I cannot determine the correct syntax to use.  LDAP?  Opath?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I don't know if is this for Exchange, but you can try:
get-contact -oganizationalunit 'ou' -filter {WindowsEmailAddress -like "*@domain.com"}

Open in new window

Or you can try to replace * with %. Try and report back.


Precisely it! I don't kow why that was so hard to find.. {attribute -like}

Worked like a friggin champ, thank you sir.
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Link for filterable attributes: http://blogs.technet.com/b/evand/archive/2007/02/19/filterable-properties-in-exchange-2007-rtm.aspx#Contact
You do not need a script block, a string containing the condition works the same.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial