• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

Messaging Tracking

Hello Team,

Could you suggest, using the below paramater, how can i try to message track for selected recipient from all transport server.
currently i need to mention particular Transport server in command to get the details

example command

Get-MessageTrackingLog -server xyz306 -recipients "Eric.Chu@xxx.com" -Start "10/19/2016 7:00AM" -End "10/19/2016 18:00PM" | select Sender,messagesubject,timestamp,eventid | out-string -width 300 | out-file c:\msgtrck1.csv

Thanks,

we have 8 exchange server in environment exchange 2013
0
Addy Nadia
Asked:
Addy Nadia
  • 8
  • 7
2 Solutions
 
SubsunCommented:
Try..
$server = Get-TransportServer | Select -exp name
$server |%{Get-MessageTrackingLog -server $_ -recipients "Eric.Chu@xxx.com" -Start "10/19/2016 7:00AM" -End "10/19/2016 18:00PM" | select Sender,messagesubject,timestamp,eventid } | Export-csv c:\msgtrck1.csv -nti

Open in new window

1
 
Addy NadiaExpertAuthor Commented:
these both command need to run at same time ?

Is there any script like this in small.. when i enter, it will ask the recipient name to mention and date and time ?
0
 
Addy NadiaExpertAuthor Commented:
i am using exchange 2013, i think there command can be use Get-TransportService
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SubsunCommented:
Yes.. You can also try this single command, but some time I have see it's gives error in EMS..
Get-TransportServer |%{Get-MessageTrackingLog -server $_.Name -recipients "Eric.Chu@xxx.com" -Start "10/19/2016 7:00AM" -End "10/19/2016 18:00PM" | select Sender,messagesubject,timestamp,eventid } | Export-csv c:\msgtrck1.csv -nti

Open in new window

Is there any script like this in small.. when i enter, it will ask the recipient name to mention and date and time ?
Simple option is to use Read-Host command..
Example, save following code in a .ps1 file and run it from Exchange Management Shell
$recipients = Read-Host "Enter Recipients"
$End = Read-Host "Enter Start Date"
$Start = Read-Host "Enter End Date"
$server = Get-TransportServer | Select -exp name
$server |%{Get-MessageTrackingLog -server $_ -recipients $recipients  -Start $Start -End $End | select Sender,messagesubject,timestamp,eventid } | Export-csv c:\msgtrck1.csv -nti

Open in new window

1
 
SubsunCommented:
For Exchange 2013, try..
$recipients = Read-Host "Enter Recipients"
$End = Read-Host "Enter Start Date"
$Start = Read-Host "Enter End Date"
Get-ExchangeServer | ? {$_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true} | Get-MessageTrackingLog -recipients $recipients  -Start $Start -End $End | select Sender,messagesubject,timestamp,eventid | Export-csv c:\msgtrck1.csv -nti

Open in new window

1
 
Addy NadiaExpertAuthor Commented:
So i need to run simply this script whithout any change?

once i run it, it will ask for Recipient,end start date?
0
 
SubsunCommented:
You need to save it in to .ps1 file and run it from EMS.
0
 
SubsunCommented:
Use updated script, there is a correction in the start and end time variable..
$recipients = Read-Host "Enter Recipients"
$Start = Read-Host "Enter Start Date"
$End = Read-Host "Enter End Date"
Get-ExchangeServer | ? {$_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true} | Get-MessageTrackingLog -recipients $recipients  -Start $Start -End $End | select Sender,messagesubject,timestamp,eventid | Export-csv c:\msgtrck1.csv -nti

Open in new window

1
 
Addy NadiaExpertAuthor Commented:
i am getting below error while running this script

WARNING:  The Get-TransportServer cmdlet will be removed in a future version of
 Exchange. Use the Get-TransportService cmdlet instead. If you have any scripts
 that use the Get-TransportServer cmdlet, update them to use the
Get-TransportService cmdlet.  For more information, see
http://go.microsoft.com/fwlink/p/?LinkId=254711.
The search time range was incorrectly specified. The End and Start parameter
values can't be the same.
    + CategoryInfo          : InvalidArgument: (:) [], LocalizedException
    + FullyQualifiedErrorId : [Server=CHLTE306,RequestId=d1153d11-b4a7-4884-a6
   16-26b3c3183d18,TimeStamp=10/20/2016 11:59:10 AM] [FailureCategory=Cmdlet-
  LocalizedException] 97A2DFBF
    + PSComputerName        : abc.domain.com


when it ask for details,
i am enetring start date in this format
10/18/2016 07:00:00 AM


Thanks,
0
 
SubsunCommented:
Try updated code which I posted for exchange 2013..
1
 
Addy NadiaExpertAuthor Commented:
now i have run your updated script , i am geeting error


The input object cannot be bound to any parameters for the command either
because the command does not take pipeline input or the input and its
properties do not match any of the parameters that take pipeline input.
    + CategoryInfo          : InvalidArgument: (chlte306:PSObject) [Get-Messag
   eTrackingLog], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,Get-MessageTrackingLog
    + PSComputerName        : exchangecasarray.abc.com
0
 
SubsunCommented:
Try changing the last line to..
Get-ExchangeServer | ? {$_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true} | %{Get-MessageTrackingLog -server $_.Name -recipients $recipients  -Start $Start -End $End | select Sender,messagesubject,timestamp,eventid} | Export-csv c:\msgtrck1.csv -nti

Open in new window

0
 
Addy NadiaExpertAuthor Commented:
Thanks, This works perfectly fine. to get more fine results

could you recommend with more filter added in (Sender,messagesubject,timestamp,eventid) to get more good results if i am tracking any email,
0
 
SubsunCommented:
That really depend on what you are tracking. If you are tracking mail send by user you can add -EventId Send, or if you are looking for any failed events then -EventId "Fail", or if you know the subject the use -MessageSubject "Payroll email".. Etc..
Refer following article for more details..
https://technet.microsoft.com/en-us/library/aa997573(v=exchg.160).aspx
0
 
Addy NadiaExpertAuthor Commented:
Thank you Very Much
0

Featured Post

Who's Defending Your Organization from Threats?

Protecting against advanced threats requires an IT dream team – a well-oiled machine of people and solutions working together to defend your organization. Download our resource kit today to learn more about the tools you need to build you IT Dream Team!

  • 8
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now