Trying to filter out the healthmailbox entries from a script we use to view failed transactions in the message tracking log for Exchange. Here's our script:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
Get-ExchangeServer | where {$_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true}| Get-MessageTrackingLog -EventID 'FAIL' -Start (Get-Date).AddHours(-24) -ResultSize Unlimited> 'C:\24hourtrans.csv'
Here's a snipped of the output:
EventId Source Sender Recipients MessageSubject
------- ------ ------ ---------- --------------
FAIL AGENT {HealthMailboxac3158ab29554d26...
FAIL AGENT {HealthMailboxa3686787e38d4f98...
We don’t want to be able to see {HealthMailbox… etc etc.
I’ve tried playing around with arrays however have been unsuccessful. Here are some examples:
$array = Get-ExchangeServer | where {$_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true}| Get-MessageTrackingLog -EventID 'FAIL' -Start (Get-Date).AddHours(-24) -ResultSize Unlimited> 'C:\24hourtrans.csv'
$array | where-object ($_.Recipients -NE ‘*healthmailbox*’)
$array = Get-ExchangeServer | where {$_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true}| Get-MessageTrackingLog -EventID 'FAIL' -Start (Get-Date).AddHours(-24) -ResultSize Unlimited> 'C:\24hourtrans.csv'
$array | where-object ($_.Sender -NE ‘*healthmailbox*’)
$array = Get-ExchangeServer | where {$_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true}| Get-MessageTrackingLog -EventID 'FAIL' -Start (Get-Date).AddHours(-24) -ResultSize Unlimited> 'C:\24hourtrans.csv'
$array | where-object ($_.Source -NE ‘AGENT’)
Any help would be appreciated.
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Helvetica; color: #9d4be8} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Helvetica} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Helvetica; min-height: 11.0px}
span.s1 {font: 12.0px Helvetica; color: #000000} span.s2 {color: #0433ff} span.s3 {color: #000000} span.s4 {color: #b8b8b8} span.s5 {color: #ff5d00} span.s6 {color: #011993} span.s7 {color: #9e1300} span.s8 {color: #942193} span.s9 {color: #9d4be8} </style>
Shaun