Sent item track

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of AniyaNetworks AniyaNetworks 2 months, 3 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #46097
    Profile photo of AniyaNetworks
    AniyaNetworks
    Participant

    Hello guys,
    Need help one more time.
    this is the script i am running to get All the Sent items for specific time proud.

    Get-TransportServer | Get-MessageTrackingLog -EventId Send -Start "$startDateFormatted 00:00:00" -End "$endDateFormatted 23:59:59" -resultsize unlimited 

    This script is working fine. but i would like to know the Specific Domain name sent items. or i would like to know what is the total sent item for internal.
    Say as example my domain is ABC.com. i would like to know what is the total sent items for ABC.com to ABC.com (Total Sent items only). Please advise how to do this.
    Thank you looking forward.

    #46109
    Profile photo of Rob Simmers
    Rob Simmers
    Participant

    Assuming your output has a Domain property, you would use Group-Object:

    $obj = @()
    $obj += [pscustomobject]@{Date=(Get-Date);Domain="abc.com";Sender="John";}
    $obj += [pscustomobject]@{Date=(Get-Date);Domain="abc.com";Sender="Lisa";}
    $obj += [pscustomobject]@{Date=(Get-Date);Domain="xyz.com";Sender="Lisa";}
    $obj += [pscustomobject]@{Date=(Get-Date);Domain="www.com";Sender="John";}
    
    $obj | Group-Object -Property Domain -NoElement
    

    Output:

    Count Name                     
    ----- ----                     
        2 abc.com                  
        1 xyz.com                  
        1 www.com  
    
    #46117
    Profile photo of AniyaNetworks
    AniyaNetworks
    Participant

    Thanks for your reply,

    This is my Script

    #Powershell 
    $nl = [Environment]::NewLine
     
    #Mailbox to gather stats on
    #$mailbox=""
     
    #Get todays date twice
    $startDate=Get-Date
    $endDate=Get-Date
    $domain= "aniyanetworks.net"
     
    #Subtract 1 day from todays date (report ending day) and 7 days from todays date (report starting day)
    $startDateFormatted=$startDate.AddDays(-32).ToShortDateString()
    $endDateFormatted=$endDate.AddDays(-1).ToShortDateString()
     
     
    #Who to send the e-mail report to.
    #Multiple e-mail addresses should be in this format ", "
    $emailFrom = "[email protected]"
    $emailTo = "[email protected]"
    $subject = "Monthly e-mail report for $domain for $startDateFormatted - $endDateFormatted"
    $smtpServer = "exchange1.aniyanetworks.net"
     
     
    # Sent e-mails
    #$sendCount = Get-TransportServer | Get-MessageTrackingLog -Start "$startDateFormatted 00:00:00" -End "$endDateFormatted 23:59:59" -Sender $mailbox -resultsize unlimited | select-object -unique MessageId
    $sendCount = Get-TransportServer | Get-MessageTrackingLog -EventId Send -Start "$startDateFormatted 00:00:00" -End "$endDateFormatted 23:59:59" -resultsize unlimited
    #$sendCount = Get-TransportServer | Get-MessageTrackingLog -EventId Send -Start "03/14/2016 00:00:00" -End "04/14/2016 23:59:59" -resultsize unlimited
    #$sendCount.count
    # Received e-mails - This works but not on generic accounts
    #$receiveCount = Get-TransportServer | Get-MessageTrackingLog -Start "$startDateFormatted 00:00:00" -End "$endDateFormatted 23:59:59" -Recipients $mailbox -resultsize unlimited | select-object -unique MessageId
     
    $sendCountString = $sendCount.count
    

    So this will give me Total Count of all the Sent items.
    but i would like to know only my domain to my domain sent items.
    such as , from [email protected] to [email protected]
    please advise.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.