Exchange Powershell help

We have an on prem exchange 2013 server and an O365 account for our Skype for Business.  Our mail flows in and out through O365.

I need a trace report showing ALL mail flowing out and who sent it.  The problem I have is that I have to pick a domain or a mailbox or something and I need ALL mail flowing to O365 from our on prem server.

The trace report isn't helping me so I'm thinking powershell.

Can anyone help with a powershell that will show me all mail flowing out from our on prem to our O365 connector and who the sender was?

Thanks

Cliff
crp0499CEOAsked:
Who is Participating?
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Something like
Get-MessageTrackingLog -EventID Transfer | ft -a Sender, Recipients, MessageSubject, Timestamp

Open in new window

does not work for you?
0
 
crp0499CEOAuthor Commented:
And how can I pipe that to a CSV please sir?
0
 
Schnell SolutionsSystems Infrastructure EngineerCommented:
Get-MessageTrackingLog -EventID Transfer | Select  Sender, Recipients, MessageSubject,Timestamp | export-csv -path c:\folder1\file1.csv
0
WEBINAR: 10 Easy Ways to Lose a Password

Join us on June 27th at 8 am PDT to learn about the methods that hackers use to lift real, working credentials from even the most security-savvy employees. We'll cover the importance of multi-factor authentication and how these solutions can better protect your business!

 
crp0499CEOAuthor Commented:
When I add the export to csv, all I get is a column in excel with that looks like a GUID or something.  when i do not pipe to csv, it outputs correctly in the command window
0
 
Schnell SolutionsSystems Infrastructure EngineerCommented:
Ohs, that is for the 'Recipient' column right? because it is a multi string value that cannot be catch as the field of an csv file. There are other formats that can catch that column, but they are not for excel, one example is to export it as XML (which is quite different).

The rest of the values that are not multiples are suppose to display ok, and if you want to check all the possible fields that you have, you can execute:

Get-MessageTrackingLog -EventID Transfer | Select  * | export-csv -path c:\folder1\file1.csv
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
You've closed the question prematurely.
For a CSV-suitable output use
Get-MessageTrackingLog -EventID Transfer |
  Select  Sender, @{n='Recipients'; e={$_.Recipients -join ';'}}, MessageSubject,Timestamp |
  export-csv -NoType c:\folder1\file1.csv

Open in new window

This creates a semicolon-separated recipients list as a single column, and also suppresses the first line with type info in the CSV which is of no use for you (It is for re-importing into PowerShell, using correct types instead of plain strings).

Another common way to handle such lists is by creating "duplicate" entries for each single recipient, but I guess that is unwanted here.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.