From a79cdd55008e11dd8087a587a07fd87d57f58f49 Mon Sep 17 00:00:00 2001 From: Shane Ferrell Date: Tue, 9 Apr 2024 16:40:11 -0700 Subject: [PATCH 1/3] Improve TimeLine, Save Raw output --- .../Get-CalendarDiagnosticObjectsSummary.ps1 | 74 ++++++++++--------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 b/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 index 001d43f439..49647f457a 100644 --- a/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 +++ b/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 @@ -723,9 +723,7 @@ function SetIsIgnorable { } elseif ($CalLog.ItemClass -eq "IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}" ) { return "Exception" } elseif (($CalendarItemTypes.($CalLog.ItemClass) -like "*Resp*" -and $CalLog.CalendarLogTriggerAction -ne "Create" ) -or - $CalendarItemTypes.($CalLog.ItemClass) -eq "AttendeeList" -or - $CalLog.CalendarLogTriggerAction -eq "MoveToDeletedItems" -or - $CalLog.CalendarLogTriggerAction -eq "SoftDelete" ) { + $CalendarItemTypes.($CalLog.ItemClass) -eq "AttendeeList" ) { return "Cleanup" } else { return "False" @@ -911,9 +909,17 @@ function BuildCSV { } $ShortName = $ShortName.Substring(0, [System.Math]::Min(20, $ShortName.Length)) $Filename = "$($ShortName)_$ShortMeetingID.csv" - Write-Host -ForegroundColor Cyan -NoNewline "Calendar Logs for [$Identity] have been saved to :" + $FilenameRaw = "$($ShortName)_RAW_$($ShortMeetingID).csv" + + Write-Host -ForegroundColor Cyan -NoNewline "Enhanced Calendar Logs for [$Identity] have been saved to : " Write-Host -ForegroundColor Yellow "$Filename" + + Write-Host -ForegroundColor Cyan -NoNewline "Raw Calendar Logs for [$Identity] have been saved to : " + Write-Host -ForegroundColor Yellow "$FilenameRaw" + $GCDOResults | Export-Csv -Path $Filename -NoTypeInformation -Encoding UTF8 + $script:GCDO | Export-Csv -Path $FilenameRaw -NoTypeInformation -Encoding UTF8 + } function MultiLineFormat { @@ -1185,32 +1191,22 @@ function BuildTimeline { MeetingRequest { switch ($CalLog.TriggerAction) { Create { - if ($CalLog.IsOrganizer) { + if ($IsOrganizer) { if ($CalLog.IsException -eq $True) { - $Output1 = "A new Exception $($CalLog.MeetingRequestType.Value) Meeting Request was created with $($CalLog.Client) for [$($CalLog.StartTime)]." - } else { - $Output1 = "A new $($CalLog.MeetingRequestType.Value) Meeting Request was created with $($CalLog.Client)" - } - - if ($CalLog.SentRepresentingEmailAddress -eq $CalLog.SenderEmailAddress) { - $Output2 = " by the Organizer [$($CalLog.ResponsibleUser)]." + [array] $Output = "[$($CalLog.ResponsibleUser)] Created an Exception Meeting Request with $($CalLog.Client) for [$($CalLog.StartTime)]." } else { - $Output2 = " by the Delegate." + [array] $Output = "[$($CalLog.ResponsibleUser)] Created a Meeting Request was with $($CalLog.Client)" } - - [array] $Output = $Output1+$Output2 - [bool] $MeetingSummaryNeeded = $True } else { if ($CalLog.DisplayAttendeesTo -ne $PreviousCalLog.DisplayAttendeesTo -or $CalLog.DisplayAttendeesCc -ne $PreviousCalLog.DisplayAttendeesCc) { [array] $Output = "The user Forwarded a Meeting Request with $($CalLog.Client)." } else { if ($CalLog.Client -eq "Transport") { if ($CalLog.IsException -eq $True) { - [array] $Output = "Transport delivered a new Meeting Request based on changes by [$($CalLog.SentRepresentingDisplayName)] for an exception starting on [$($CalLog.StartTime)]." - [bool] $MeetingSummaryNeeded = $True + [array] $Output = "Transport delivered a new Meeting Request from [$($CalLog.SentRepresentingDisplayName)] for an exception starting on [$($CalLog.StartTime)]" + $(if ($null -ne $($CalLog.ReceivedRepresenting)) { " for user [$($CalLog.ReceivedRepresenting)]" }) + "." + $MeetingSummaryNeeded = $True } else { - [array] $Output = "Transport delivered a new Meeting Request based on changes by [$($CalLog.SentRepresentingDisplayName)]." - [bool] $MeetingSummaryNeeded = $True + [Array]$Output = "Transport delivered a new Meeting Request from [$($CalLog.SentRepresentingDisplayName)]" + $(if ($null -ne $($CalLog.ReceivedRepresenting)) { " for user [$($CalLog.ReceivedRepresenting)]" }) + "." } } elseif ($CalLog.Client -eq "CalendarRepairAssistant") { if ($CalLog.IsException -eq $True) { @@ -1269,7 +1265,7 @@ function BuildTimeline { $Extra = " to the meeting series" } - if ($CalLog.IsOrganizer) { + if ($IsOrganizer) { [array] $Output = "[$($CalLog.SentRepresentingDisplayName)] $($Action) a $($MeetingRespType) Meeting Response message$($Extra)." } else { switch ($CalLog.Client) { @@ -1297,22 +1293,22 @@ function BuildTimeline { IpmAppointment { switch ($CalLog.TriggerAction) { Create { - if ($CalLog.IsOrganizer) { + if ($IsOrganizer) { if ($CalLog.Client -eq "Transport") { - [array] $Output = "Transport created a new meeting." + [array] $Output = "Transport Created a new meeting." } else { - [array] $Output = "[$($CalLog.SentRepresentingDisplayName)] created a new Meeting with $($CalLog.Client)." + [array] $Output = "[$($CalLog.ResponsibleUser)] Created a new Meeting with $($CalLog.Client)." } } else { switch ($CalLog.Client) { Transport { - [array] $Output = "Transport added a new Tentative Meeting from [$($CalLog.SentRepresentingDisplayName)] to the Calendar." + [array] $Output = "Transport Created a new Meeting on the calendar from [$($CalLog.SentRepresentingDisplayName)] and marked it Tentative." } ResourceBookingAssistant { - [array] $Output = "ResourceBookingAssistant added a new Tentative Meeting from [$($CalLog.SentRepresentingDisplayName)] to the Calendar." + [array] $Output = "ResourceBookingAssistant Created a new Meeting on the calendar from [$($CalLog.SentRepresentingDisplayName)] and marked it Tentative." } default { - [array] $Output = "[$($CalLog.ResponsibleUser)] created the Meeting with $($CalLog.Client)." + [array] $Output = "[$($CalLog.ResponsibleUser)] Created the Meeting with $($CalLog.Client)." } } } @@ -1320,7 +1316,11 @@ function BuildTimeline { Update { switch ($CalLog.Client) { Transport { - [array] $Output = "Transport $($CalLog.TriggerAction)d the meeting based on changes made by [$($CalLog.SentRepresentingDisplayName)]." + if ($CalLog.ResponsibleUser -eq "Calendar Assistant") { + [array] $Output = "Transport Updated the meeting based on changes made to the meeting on [$($CalLog.Sender)] calendar." + } else { + [array] $Output = "Transport $($CalLog.TriggerAction)d the meeting based on changes made by [$($CalLog.ResponsibleUser)]." + } } LocationProcessor { [array] $Output = "" @@ -1349,8 +1349,14 @@ function BuildTimeline { } $AddChangedProperties = $False } elseif ($CalLog.FreeBusyStatus -ne 2 -and $PreviousCalLog.FreeBusyStatus -eq 2) { - [array] $Output = "[$($CalLog.ResponsibleUser)] Declined the Meeting with $($CalLog.Client)." - $AddChangedProperties = $False + if ($IsOrganizer) { + [array] $Output = "[$($CalLog.ResponsibleUser)] Cancelled the Meeting with $($CalLog.Client)." + } else { + if ($CalLog.ResponsibleUser -ne "Calendar Assistant") { + [array] $Output = "[$($CalLog.ResponsibleUser)] Declined the meeting with $($CalLog.Client)." + } + } + $AddChangedProperties = $False } } SoftDelete { @@ -1387,7 +1393,7 @@ function BuildTimeline { } default { [array] $Output = "[$($CalLog.ResponsibleUser)] $($CalLog.TriggerAction) the Meeting with $($CalLog.Client)." - [bool] $MeetingSummaryNeeded = $False + $MeetingSummaryNeeded = $False } } } @@ -1395,9 +1401,9 @@ function BuildTimeline { switch ($CalLog.Client) { Transport { if ($CalLog.IsException -eq $True) { - [array] $Output = "Transport $($CalLog.TriggerAction)d a Meeting Cancellation based on changes by [$($CalLog.SentRepresentingDisplayName)] for the exception starting on [$($CalLog.StartTime)]" + [array] $Output = "Transport $($CalLog.TriggerAction)d a Meeting Cancellation based on changes by [$($CalLog.SenderSMTPAddress)] for the exception starting on [$($CalLog.StartTime)]" } else { - [array] $Output = "Transport $($CalLog.TriggerAction)d a Meeting Cancellation based on changes by [$($CalLog.SentRepresentingDisplayName)]." + [array] $Output = "Transport $($CalLog.TriggerAction)d a Meeting Cancellation based on changes by [$($CalLog.SenderSMTPAddress)]." } } default { @@ -1618,7 +1624,7 @@ if (-not ([string]::IsNullOrEmpty($Subject)) ) { if ($script:GCDO.count -gt 0) { Write-Host -ForegroundColor Cyan "Found $($script:GCDO.count) CalLogs with MeetingID [$MeetingID]." - $IsOrganizer = (SetIsOrganizer -CalLogs $script:GCDO) + $script:IsOrganizer = (SetIsOrganizer -CalLogs $script:GCDO) Write-Host -ForegroundColor Cyan "The user [$ID] $(if ($IsOrganizer) {"IS"} else {"is NOT"}) the Organizer of the meeting." $IsRoomMB = (SetIsRoom -CalLogs $script:GCDO) if ($IsRoomMB) { From 95164be02f3f9386f1772e0a98f9f02aab711e0b Mon Sep 17 00:00:00 2001 From: Shane Ferrell Date: Wed, 10 Apr 2024 12:17:51 -0700 Subject: [PATCH 2/3] build issues --- Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 b/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 index 49647f457a..da619519ec 100644 --- a/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 +++ b/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 @@ -910,7 +910,7 @@ function BuildCSV { $ShortName = $ShortName.Substring(0, [System.Math]::Min(20, $ShortName.Length)) $Filename = "$($ShortName)_$ShortMeetingID.csv" $FilenameRaw = "$($ShortName)_RAW_$($ShortMeetingID).csv" - + Write-Host -ForegroundColor Cyan -NoNewline "Enhanced Calendar Logs for [$Identity] have been saved to : " Write-Host -ForegroundColor Yellow "$Filename" @@ -919,7 +919,6 @@ function BuildCSV { $GCDOResults | Export-Csv -Path $Filename -NoTypeInformation -Encoding UTF8 $script:GCDO | Export-Csv -Path $FilenameRaw -NoTypeInformation -Encoding UTF8 - } function MultiLineFormat { @@ -1206,7 +1205,9 @@ function BuildTimeline { [array] $Output = "Transport delivered a new Meeting Request from [$($CalLog.SentRepresentingDisplayName)] for an exception starting on [$($CalLog.StartTime)]" + $(if ($null -ne $($CalLog.ReceivedRepresenting)) { " for user [$($CalLog.ReceivedRepresenting)]" }) + "." $MeetingSummaryNeeded = $True } else { - [Array]$Output = "Transport delivered a new Meeting Request from [$($CalLog.SentRepresentingDisplayName)]" + $(if ($null -ne $($CalLog.ReceivedRepresenting)) { " for user [$($CalLog.ReceivedRepresenting)]" }) + "." + [Array]$Output = "Transport delivered a new Meeting Request from [$($CalLog.SentRepresentingDisplayName)]" + + $(if ($null -ne $($CalLog.ReceivedRepresenting) -and $CalLog.ReceivedRepresenting -ne $CalLog.ReceivedBy) + { " for user [$($CalLog.ReceivedRepresenting)]" }) + "." } } elseif ($CalLog.Client -eq "CalendarRepairAssistant") { if ($CalLog.IsException -eq $True) { @@ -1349,14 +1350,14 @@ function BuildTimeline { } $AddChangedProperties = $False } elseif ($CalLog.FreeBusyStatus -ne 2 -and $PreviousCalLog.FreeBusyStatus -eq 2) { - if ($IsOrganizer) { + if ($IsOrganizer) { [array] $Output = "[$($CalLog.ResponsibleUser)] Cancelled the Meeting with $($CalLog.Client)." } else { if ($CalLog.ResponsibleUser -ne "Calendar Assistant") { [array] $Output = "[$($CalLog.ResponsibleUser)] Declined the meeting with $($CalLog.Client)." } } - $AddChangedProperties = $False + $AddChangedProperties = $False } } SoftDelete { From 8a38e1b4b2f75b492fa4ee66a8aba4c791d67b17 Mon Sep 17 00:00:00 2001 From: Shane Ferrell Date: Thu, 11 Apr 2024 14:06:45 -0700 Subject: [PATCH 3/3] Fix Copy error on ChangedProperties --- Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 b/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 index da619519ec..9763ecd9b2 100644 --- a/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 +++ b/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 @@ -1076,14 +1076,15 @@ function BuildTimeline { } if ($CalLog.SubjectProperty -ne $PreviousCalLog.SubjectProperty) { - [Array]$TimeLineText = "The EndTime changed from [$($PreviousCalLog.SubjectProperty)] to: [$($CalLog.SubjectProperty)]" + [Array]$TimeLineText = "The SubjectProperty changed from [$($PreviousCalLog.SubjectProperty)] to: [$($CalLog.SubjectProperty)]" MeetingSummary -Time " " -MeetingChanges $TimeLineText } if ($CalLog.NormalizedSubject -ne $PreviousCalLog.NormalizedSubject) { - [Array]$TimeLineText = "The EndTime changed from [$($PreviousCalLog.NormalizedSubject)] to: [$($CalLog.NormalizedSubject)]" + [Array]$TimeLineText = "The NormalizedSubject changed from [$($PreviousCalLog.NormalizedSubject)] to: [$($CalLog.NormalizedSubject)]" MeetingSummary -Time " " -MeetingChanges $TimeLineText } + if ($CalLog.Location -ne $PreviousCalLog.Location) { [Array]$TimeLineText = "The Location changed from [$($PreviousCalLog.Location)] to: [$($CalLog.Location)]" MeetingSummary -Time " " -MeetingChanges $TimeLineText