# Initialize some variables used for counting and for output $From = Get-Date "15/07/2014" $To = $From.AddDays(1) $TotalOutput = @() [Int64] $intSent = $intRec = 0 [Int64] $intSentSize = $intRecSize = 0 [String] $strEmails = $null Do { # Start building the variable that will hold the information for the day $obj = new-object PSObject $obj | add-member -membertype NoteProperty -name "DayOfWeek" -value $($From.DayOfWeek) $obj | add-member -membertype NoteProperty -name "Date" -value $($From.ToShortDateString()) $intSent = $intRec = 0 (Get-TransportServer) | Get-MessageTrackingLog -ResultSize Unlimited -Start $From -End $To | ForEach { # Sent E-mails If ($_.EventId -eq "RECEIVE" -and $_.Source -eq "STOREDRIVER") { $intSent++ ...