Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Get SMTP Statistics based on users in CSV file

$
0
0

Hi,

I am trying to find a script that gets the e-mails sent/received based on primary e-mail addresses of users that I filtered out in a CSV file, I used the cmdlet Get-MessageTrackingLog, however, the Sender parameter is not accepting any variables:

This is the PS code I used:

$servers = Get-ExchangeServer | where {$_.ServerRole -match 'HubTransport'}
$Senders = Import-CSV 'C:\Temp\Senders.csv'
$r = ForEach ($server in $servers)
      {

          ForEach ($sender in $sernders) {

Get-MessageTrackingLog -Resultsize unlimited -Server $server -Sender $sender

                     }
      }
$r |select {$_.Recipients}, {$_.RecipientStatus}, Sender, MessageSubject | Export-CSV C:\Temp\Output.csv -Notype

The error message said that can't convert system type object to a string data type required by -sender parameter

Thanks alot for your help in advance



Viewing all articles
Browse latest Browse all 15028

Trending Articles



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