Skip to content

Commit

Permalink
Merge pull request #1964 from microsoft/main
Browse files Browse the repository at this point in the history
Release v2 1-29-2024
  • Loading branch information
dpaulson45 authored Jan 29, 2024
2 parents 12b67b1 + 92fa7d9 commit b2a57cf
Showing 1 changed file with 72 additions and 25 deletions.
97 changes: 72 additions & 25 deletions Calendar/Get-CalendarDiagnosticObjectsSummary.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
# The MeetingID of the meeting to query.
#
# .PARAMETER TrackingLogs
# Include specific tracking logs in the output.
# Include specific tracking logs in the output. Only useable with the MeetingID parameter.
#
# .PARAMETER Exceptions
# Include Exception objects in the output. Only useable with the MeetingID parameter.
#
# .EXAMPLE
# Get-CalendarDiagnosticObjectsSummary.ps1 -Identity someuser@microsoft.com -MeetingID 040000008200E00074C5B7101A82E008000000008063B5677577D9010000000000000000100000002FCDF04279AF6940A5BFB94F9B9F73CD
Expand All @@ -33,6 +36,7 @@ param (
[Parameter(Mandatory, ParameterSetName = 'MeetingID', Position = 1)]
[string]$MeetingID,
[switch]$TrackingLogs,
[switch]$Exceptions,

[Parameter(Mandatory, ParameterSetName = 'Subject', Position = 1)]
[string]$Subject
Expand Down Expand Up @@ -558,6 +562,8 @@ function CreateShortClientName {
$ShortClientName = "TimeService"
} elseif ($ClientInfoString -like "*AppId=48af08dc-f6d2-435f-b2a7-069abd99c086*") {
$ShortClientName = "RestConnector"
} elseif ($ClientInfoString -like "*Client=OutlookService;Outlook-Android*") {
$ShortClientName = "OutlookAndroid"
} elseif ($ClientInfoString -like "*GriffinRestClient*") {
$ShortClientName = "GriffinRestClient"
} elseif ($ClientInfoString -like "*MacOutlook*") {
Expand Down Expand Up @@ -633,14 +639,16 @@ function SetIsIgnorable {
$CalLog.CalendarLogTriggerAction -ne "Create" ) -or
$CalendarItemTypes.($CalLog.ItemClass) -eq "AttendeeList") {
return "Resp"
} elseif ($CalLog.ItemClass -eq "IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}") {
return "Exception"
} elseif ($ShortClientName -like "EBA*" -or
$ShortClientName -like "TBA*" -or
$ShortClientName -eq "LocationProcessor" -or
$ShortClientName -eq "GriffinRestClient" -or
$ShortClientName -eq "RestConnector" -or
$ShortClientName -eq "ELC-B2" -or
$ShortClientName -eq "TimeService" ) {
return "True"
return "Ignorable"
} else {
return "False"
}
Expand Down Expand Up @@ -831,14 +839,6 @@ function BuildCSV {
Write-Host -ForegroundColor Cyan -NoNewline "Calendar Logs for [$Identity] have been saved to :"
Write-Host -ForegroundColor Yellow "$Filename"
$GCDOResults | Export-Csv -Path $Filename -NoTypeInformation -Encoding UTF8

$MeetingTimeLine = $Results | Where-Object { $_.IsIgnorable -eq "False" }
Write-Host "`n`n`nThis is the meetingID $ThisMeetingID`nThis is Short MeetingID $ShortMeetingID"
if ($MeetingTimeLine.count -eq 0) {
Write-Host "All CalLogs are Ignorable, nothing to create a timeline with, displaying initial values."
} else {
Write-Host "Found $($script:GCDO.count) Log entries, only the $($MeetingTimeLine.count) Non-Ignorable entries will be analyzed in the TimeLine."
}
}

function MultiLineFormat {
Expand Down Expand Up @@ -959,7 +959,15 @@ function BuildTimeline {
[Array]$Header = ("Subject: " + ($script:GCDO[0].NormalizedSubject) + " | MeetingID: "+ ($script:GCDO[0].CleanGlobalObjectId))
MeetingSummary -Time "Calendar Log Timeline for Meeting with" -MeetingChanges $Header
MeetingSummary -Time "Initial Message Values" -Entry $script:GCDO[0] -LongVersion
$MeetingTimeLine = $Results | Where-Object { $_.IsIgnorable -eq "False" }
# Ignorable and items from Shared Calendars are not included in the TimeLine.
$MeetingTimeLine = $Results | Where-Object { $_.IsIgnorable -eq "False" -and $_.IsFromSharedCalendar -eq $False }

Write-Host "`n`n`nThis is the meetingID $ThisMeetingID`nThis is Short MeetingID $ShortMeetingID"
if ($MeetingTimeLine.count -eq 0) {
Write-Host "All CalLogs are Ignorable, nothing to create a timeline with, displaying initial values."
} else {
Write-Host "Found $($script:GCDO.count) Log entries, only the $($MeetingTimeLine.count) Non-Ignorable entries will be analyzed in the TimeLine."
}

foreach ($CalLog in $MeetingTimeLine) {
[bool] $MeetingSummaryNeeded = $False
Expand Down Expand Up @@ -1062,7 +1070,7 @@ function BuildTimeline {
}

if ($CalLog.MeetingRequestType -ne $PreviousCalLog.MeetingRequestType) {
[Array]$TimeLineText = "The Meeting Request Type changed from [$($PreviousCalLog.MeetingRequestType)] to: [$($CalLog.MeetingRequestType)]"
[Array]$TimeLineText = "The Meeting Request Type changed from [$($PreviousCalLog.MeetingRequestType.Value)] to: [$($CalLog.MeetingRequestType.Value)]"
MeetingSummary -Time " " -MeetingChanges $TimeLineText
}

Expand Down Expand Up @@ -1109,7 +1117,7 @@ function BuildTimeline {
Create {
if ($CalLog.IsOrganizer) {
if ($CalLog.IsException -eq $True) {
$Output1 = "A new Exception $($CalLog.MeetingRequestType.Value) Meeting Request was created with $($CalLog.Client)"
$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)"
}
Expand All @@ -1127,8 +1135,19 @@ function BuildTimeline {
[array] $Output = "The user Forwarded a Meeting Request with $($CalLog.Client)."
} else {
if ($CalLog.Client -eq "Transport") {
[array] $Output = "Transport delivered a new Meeting Request from $($CalLog.SentRepresentingDisplayName)."
[bool] $MeetingSummaryNeeded = $True
if ($CalLog.IsException -eq $True) {
[array] $Output = "[$($CalLog.SentRepresentingDisplayName)] send a new Meeting Request via Transport for an exception starting on [$($CalLog.StartTime)]."
[bool] $MeetingSummaryNeeded = $True
} else {
[array] $Output = "[$($CalLog.SentRepresentingDisplayName)] send a new Meeting Request via Transport."
[bool] $MeetingSummaryNeeded = $True
}
} elseif ($CalLog.Client -eq "CalendarRepairAssistant") {
if ($CalLog.IsException -eq $True) {
[array] $Output = "CalendarRepairAssistant Created a new Meeting Request to repair an inconsistency with an exception starting on [$($CalLog.StartTime)]."
} else {
[array] $Output = "CalendarRepairAssistant Created a new Meeting Request to repair an inconsistency."
}
} else {
if ($CalLog.IsException -eq $True) {
[array] $Output = "[$($CalLog.ResponsibleUser)] Created a new Meeting Request with $($CalLog.Client) for an exception starting on [$($CalLog.StartTime)]."
Expand All @@ -1140,7 +1159,7 @@ function BuildTimeline {
}
}
Update {
[array] $Output = "$($CalLog.ResponsibleUser) updated on the $($CalLog.MeetingRequestType) Meeting Request with $($CalLog.Client)."
[array] $Output = "[$($CalLog.ResponsibleUser)] Updated on the $($CalLog.MeetingRequestType.Value) Meeting Request with $($CalLog.Client)."
}
MoveToDeletedItems {
if ($CalLog.ResponsibleUser -eq "Calendar Assistant") {
Expand All @@ -1150,7 +1169,7 @@ function BuildTimeline {
}
}
default {
[array] $Output = "[$($CalLog.ResponsibleUser)] Deleted the $($CalLog.MeetingRequestType) Meeting Request with $($CalLog.Client)."
[array] $Output = "[$($CalLog.ResponsibleUser)] Deleted the $($CalLog.MeetingRequestType.Value) Meeting Request with $($CalLog.Client)."
}
}
}
Expand Down Expand Up @@ -1217,10 +1236,10 @@ function BuildTimeline {
} else {
switch ($CalLog.Client) {
Transport {
[array] $Output = "$($CalLog.Client) added a new Tentative Meeting from $($CalLog.SentRepresentingDisplayName) to the Calendar."
[array] $Output = "Transport added a new Tentative Meeting from [$($CalLog.SentRepresentingDisplayName)] to the Calendar."
}
ResourceBookingAssistant {
[array] $Output = "$($CalLog.Client) added a new Tentative Meeting from $($CalLog.SentRepresentingDisplayName) to the Calendar."
[array] $Output = "ResourceBookingAssistant added a new Tentative Meeting from [$($CalLog.SentRepresentingDisplayName)] to the Calendar."
}
default {
[array] $Output = "[$($CalLog.ResponsibleUser)] created the Meeting with $($CalLog.Client)."
Expand All @@ -1231,14 +1250,17 @@ function BuildTimeline {
Update {
switch ($CalLog.Client) {
Transport {
[array] $Output = "Transport $($CalLog.TriggerAction)d the meeting."
[array] $Output = "[$($CalLog.SentRepresentingDisplayName)] made changed which caused Transport to $($CalLog.TriggerAction) the meeting."
}
LocationProcessor {
[array] $Output = ""
}
ResourceBookingAssistant {
[array] $Output = "ResourceBookingAssistant $($CalLog.TriggerAction)d the Meeting."
}
CalendarRepairAssistant {
[array] $Output = "CalendarRepairAssistant $($CalLog.TriggerAction)d the Meeting to repair an inconsistency."
}
default {
if ($CalLog.ResponsibleUser -eq "Calendar Assistant") {
[array] $Output = "The Exchange System $($CalLog.TriggerAction)d the meeting via the Calendar Assistant."
Expand All @@ -1264,7 +1286,7 @@ function BuildTimeline {
SoftDelete {
switch ($CalLog.Client) {
Transport {
[array] $Output = "Transport $($CalLog.TriggerAction)d the Meeting."
[array] $Output = "[$($CalLog.SentRepresentingDisplayName)] made changed which caused Transport to $($CalLog.TriggerAction) the Meeting."
}
LocationProcessor {
[array] $Output = ""
Expand Down Expand Up @@ -1302,7 +1324,11 @@ function BuildTimeline {
Cancellation {
switch ($CalLog.Client) {
Transport {
[array] $Output = "Transport $($CalLog.TriggerAction)d the Meeting Cancellation from $($CalLog.SentRepresentingDisplayName)."
if ($CalLog.IsException -eq $True) {
[array] $Output = "[$($CalLog.SentRepresentingDisplayName)] $($CalLog.TriggerAction)d a Meeting Cancellation delivered by Transport for the exception starting on [$($CalLog.StartTime)]"
} else {
[array] $Output = "[$($CalLog.SentRepresentingDisplayName)] $($CalLog.TriggerAction)d a Meeting Cancellation delivered by Transport."
}
}
default {
if ($CalLog.IsException -eq $True) {
Expand Down Expand Up @@ -1398,7 +1424,7 @@ function CheckIdentities {
if (Get-Command -Name Get-Mailbox -ErrorAction SilentlyContinue) {
Write-Host "Validated connection to Exchange Online."
} else {
Write-Error "Get-Mailbox cmdlet not found. Please validate that you are running this script from an Exchange Management Shell and try again."
Write-Error "Get-Mailbox cmdlet not found. Please validate that you are running this script from an Exchange Management Shell and try again."
Write-Host "Look at Import-Module ExchangeOnlineManagement and Connect-ExchangeOnline."
exit
}
Expand Down Expand Up @@ -1512,14 +1538,35 @@ if (-not ([string]::IsNullOrEmpty($Subject)) ) {
} elseif (-not ([string]::IsNullOrEmpty($MeetingID))) {

foreach ($ID in $ValidatedIdentities) {
#$script:GCDO = $script:InitialCDOs; # use the CalLogs that we already have, since there is only one.
# $script:InitialCDOs = @(); # clear the Initial CDOs.
Write-DashLineBoxColor "Looking for CalLogs from [$ID] with passed in MeetingID."
Write-Verbose "Running: Get-CalendarDiagnosticObjects -Identity [$ID] -MeetingID [$MeetingID] -CustomPropertyNames $CustomPropertyNameList -WarningAction Ignore -MaxResults $LogLimit -ResultSize $LogLimit -ShouldBindToItem $true;"
$script:GCDO = GetCalendarDiagnosticObjects -Identity $ID -MeetingID $MeetingID

if ($script:GCDO.count -gt 0) {
Write-Host "Found $($script:GCDO.count) CalLogs with MeetingID [$MeetingID]."
if ($Exceptions.IsPresent) {
Write-Host -ForegroundColor Cyan "Looking for Exception Logs..."
#collect Exception Logs
$ExceptionLogs = @()
$LogToExamine = @()
$LogToExamine = $script:GCDO | Where-Object { $_.ItemClass -like 'IPM.Appointment*' } | Sort-Object ItemVersion

Write-Host -ForegroundColor Cyan "Found $($LogToExamine.count) CalLogs to examine for Exception Logs."
Write-Host -ForegroundColor Cyan "`t Ignore the next [$($LogToExamine.count)] warnings..."

$ExceptionLogs = $LogToExamine | ForEach-Object {
Write-Verbose "Getting Exception Logs for [$($_.ItemId.ObjectId)]"
Get-CalendarDiagnosticObjects -Identity $ID -ItemIds $_.ItemId.ObjectId -ShouldFetchRecurrenceExceptions $true -CustomPropertyNames $CustomPropertyNameList
}
# Remove the IPM.Appointment logs as they are already in the CalLogs.
$ExceptionLogs = $ExceptionLogs | Where-Object { $_.ItemClass -notlike "IPM.Appointment*" }
Write-Host -ForegroundColor Cyan "Found $($ExceptionLogs.count) Exception Logs, adding them into the CalLogs."

$script:GCDO = $script:GCDO + $ExceptionLogs | Select-Object *, @{n='OrgTime'; e= { [DateTime]::Parse($_.OriginalLastModifiedTime.ToString()) } } | Sort-Object OrgTime
$LogToExamine = $null
$ExceptionLogs = $null
}

BuildCSV -Identity $ID
BuildTimeline -Identity $ID
} else {
Expand Down

0 comments on commit b2a57cf

Please sign in to comment.