Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Large Mail Senders with exclusions

$
0
0

My Problem

We have email archiving enabled for all users in our Organization, i.e. any email you send/receive outside or inside my organization will be sent to archiving server at DELL.

Below is a cmdlet for creating a report of all large emails in organization above 10MB for last 7 days with total bytes in MB and later excluding all emails going to archiving server for which ending address is@ems-1.activemailbox.net

Get-Messagetrackinglog -resultsize unlimited -Start ((get-date)-(new-timespan -days 6)) -End (get-date) | where {$_.totalbytes -gt 10485760} | Sort-Object “totalbytes” -Descending | Select-Object sender,timestamp, @{Name="Recipients";Expression={$_.recipients -notlike "*@ems-1.activemailbox.net"}}, messagesubject,totalbytes, @{name="Size";Expression={$_.totalbytes.ToMB()}}

 

The problem is that the above command for "notlike" only removes the recipient address from the log but not the whole line.


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>