1

I can't seem to figure out why this where object filter is not working. here is the code:

Get-MailDetailTransportRuleReport -StartDate 08/25/2022 -EndDate 09/07/2022 | Where-Object -Property SenderAddress -NotContains "@EMAIL-DOMAIN-HERE" | fl Date, Subject, Direction, SenderAddress, RecipientAddress, TransportRule 

and I am of course, getting all of the results with the "@EMAIL-DOMAIN-HERE" still in it.

0

1 Answer 1

4

-notcontains is a collection containment operator, not a string comparison operator.

Use -notlike instead and make sure you include appropriate wildcards:

| Where-Object -Property SenderAddress -NotLike "*@EMAIL-DOMAIN-HERE" 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.