none
Help with Get-MessageTrackingLog commandlet RRS feed

  • General discussion

  • Hi,

    I'm looking to get a total number of emails sent within my org and to only email within my org. Here is the PowerShell script i have so far

    get-messagetrackinglog -ResultSize unlimited -Start “01/01/2018 00:00:00″ -End “30/04/2018 23:59:00″ | where {$_.Sender -like “*@domain-name“} | where {$_.Recipients -like “*@domain-name“} > “C:sent.csv

    It is not working as you can imaging.

    Can someone help edit the cmdlet?


    • Edited by JTT2019 Wednesday, June 19, 2019 4:23 AM
    • Changed type Bill_Stewart Thursday, September 5, 2019 9:36 PM
    • Moved by Bill_Stewart Thursday, September 5, 2019 9:36 PM Off-topic
    Wednesday, June 19, 2019 3:17 AM

All replies

  • Thank you Slave.

    I tried the cmdlet after connecting to the Outlook.office365.com session but i get this error:

    Get-MessageTrackingLog : The term 'Get-MessageTrackingLog' is not recognized
    file, or operable program. Check the spelling of the name, or if a path was
    and try again.
    At line:1 char:1
    + Get-MessageTrackingLog -Start "01/06/2019 00:00:00" -End "15/06/2019  ...


    Wednesday, June 19, 2019 9:16 AM
  • Forgot to mention i'm running to a DC with PowerShell version 1.
    Wednesday, June 19, 2019 9:21 AM
  • PowerShell v1 has been obsolete, unsupported, and deprecated for a number of years now and was only available on downlevel OS versions. Are you sure you're really using PowerShell v1? What OS are you using?

    -- Bill Stewart [Bill_Stewart]

    Wednesday, June 19, 2019 2:16 PM
  • Hi Slava,

    Apologies for not spelling your name correctly previously :( 

    I ran the cmdlet and this error comes up. I've tried changing mm/dd/yyyy and even added AM/PM but it still not working.



    Thursday, June 20, 2019 12:29 AM
  • Hi Bill,

    I assume that the below is PS version 1?

    ModuleType Vesion

    Script          1.0

    I'm running Windows PowerShell on Server 2012.

    Thursday, June 20, 2019 1:05 AM
  • That's telling you the module version, not the PowerShell version. To see your PowerShell version, run $PSVersionTable at a PowerShell prompt. The PSVersion property in the output will tell you the PowerShell version.


    -- Bill Stewart [Bill_Stewart]

    Thursday, June 20, 2019 1:15 PM
  • Thanks Bill.

    Name                           Value
    ----                           -----
    PSVersion                      5.1.14409.1018

    I'm still having issue with the script. Tried Slava's version as well. 

    Thursday, June 20, 2019 10:58 PM
  • Get-Message* CmdLets are not part of Windows or of PowerShell.  You must install the correct on-premises version or connect to Exchange online to use the online CmdLets.

    \_(ツ)_/

    Thursday, June 20, 2019 11:02 PM
  • Yes i used these commands first to connect to  Exchange Online.

    $UserCredential = Get-Credential

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

    Import-PSSession $Session -DisableNameChecking

    Thursday, June 20, 2019 11:16 PM
  • And what log trace command did you use?


    \_(ツ)_/

    Thursday, June 20, 2019 11:18 PM
  • Hi jrv.

    I tried this but i realised that i needed to use Exchange Online version Get-MessageTrace.

    get-messagetrackinglog -ResultSize unlimited -Start “01/01/2018 00:00:00″ -End “30/04/2018 23:59:00″ | where {$_.Sender -like “*@domain-name“} | where {$_.Recipients -like “*@domain-name“} > “C:sent.csv

    I need to get total amount of email sent internally and to internal emails only. 

    Friday, June 21, 2019 2:10 AM