如果你正在寻找具体的信息,并有许多不同的Exchange2007服务器,无论是集线器或邮箱服务器,这个脚本可以帮助你!
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
$strRecipient = Read-Host "Enter part or recipient e-mail address like *toto* "
#$strSender = Read-Host "Enter part or sender e-mail address"
#$strSubject = Read-Host "Enter part of the subject"
$strStart = Read-Host "Enter start date DD-MM-YY"
$strEnd = Read-Host "Enter end date DD-MM-YY (the day after to include a specific day) "
write-host "Please wait"
write-host "Please wait."
write-host "Please wait.."
write-host "Please wait..."
write-host "Please wait...."
write-host "Please wait....."
write-host "Search will depend on the number of logs that are viewed..."
Get-ExchangeServer | where {$_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true} | Get-MessageTrackingLog -ResultSize Unlimited -EventID "RECEIVE" -Start $strStart -End $strEnd | where {$_.recipients -like "$strRecipient"} | Select-Object Timestamp,ServerHostname,ClientHostname,Source,EventId,Sender,@{Name=”Recipients”;Expression={$_.recipients}},MessageSubject | Sort-Object -Property Timestamp | export-csv "C:\temp\trackingresults.csv"
write-host "The file C:\TEMP\trackingresults.csv has been created."
start-sleep 5