Solved

Exchange Powershell help

Posted on 2016-11-11
6
33 Views
Last Modified: 2016-11-13
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
0
Comment
Question by:crp0499
  • 2
  • 2
  • 2
6 Comments
 
LVL 68

Accepted Solution

by:
Qlemo earned 250 total points
ID: 41884588
Something like
Get-MessageTrackingLog -EventID Transfer | ft -a Sender, Recipients, MessageSubject, Timestamp

Open in new window

does not work for you?
0
 

Author Comment

by:crp0499
ID: 41885015
And how can I pipe that to a CSV please sir?
0
 
LVL 14

Assisted Solution

by:Schnell Solutions
Schnell Solutions earned 250 total points
ID: 41885019
Get-MessageTrackingLog -EventID Transfer | Select  Sender, Recipients, MessageSubject,Timestamp | export-csv -path c:\folder1\file1.csv
0
Free book by J.Peter Bruzzese, Microsoft MVP

Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

 

Author Comment

by:crp0499
ID: 41885022
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
 
LVL 14

Expert Comment

by:Schnell Solutions
ID: 41885030
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
 
LVL 68

Expert Comment

by:Qlemo
ID: 41885242
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

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now