Message Tracking Multiple users

Hi Readers,

Today I am sharing a script that reads list of users from CSV file & extract message tracking logs based on the dates mentioned in CSV.

Here is the example CSV file:

& here are the results in log folder that will be received after script execution

Download & extract the zip file from link provided, populate the csv file & run the batch , below will be the output on the screen.

http://gallery.technet.microsoft.com/scriptcenter/Message-Tracking-Multiple-439b1e26

###################################################################################### 
# 
#                       Author: Vikas Sukhija 
#                       Description: Message Tracking Multiple users from CSV  
#                       based on diffrent dates 
#                       Date:- 08/02/2014 
###################################################################################### 
 
If ((Get-PSSnapin | where {$_.Name -match "Microsoft.Exchange.Management.PowerShell.E2010"}) -eq $null) 
 
{  
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 
} 
 
$data = import-csv .\Trackingfile.csv 
 
foreach ($i in $data) 
 
{ 
 
$userid = $i.NetworkID 
$start = $i.TERM_EFFECTIVE_DATE 
$end = $i.Trackingtilldate 
$sender = $i.Sender 
$csv = ".\logs" + "\" + $userid + "_.csv" 
 
@" 
$userid 
$start 
$end 
$sender 
"@ 
 
Write-host "Message Tracking started for ------------------------$userid" -foregroundcolor Green 
 
Get-transportserver | Get-MessageTrackingLog -Start $start -End $end -sender $sender –resultsize unlimited  |  
select Timestamp,clientip,ClientHostname, 
ServerIp,ServerHostname,sender,EventId, 
MessageSubject, TotalBytes , SourceContext,ConnectorId, 
Source ,@{Name=”Recipents”;Expression={$_.recipients}} | export-csv $csv 
 
} 
 
###################################################################################### 
 

Regards

Sukhija Vikas

http://msexchange.me

Advertisements

One thought on “Message Tracking Multiple users

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s