Skip to content

Commit

Permalink
Merge pull request #2182 from Shanefe/CalLogAugTweaks
Browse files Browse the repository at this point in the history
Aug Tweaks to CalLog Script
  • Loading branch information
dpaulson45 committed Sep 10, 2024
2 parents 05a447d + f1f0734 commit b38113f
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 22 deletions.
2 changes: 0 additions & 2 deletions Calendar/CalLogHelpers/CalLogCSVFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ function BuildCSV {
'OriginalLogFolder' = $CalLog.OriginalParentDisplayName
'SharedFolderName' = MapSharedFolder($CalLog.ExternalSharingMasterId)
'IsFromSharedCalendar' = $IsFromSharedCalendar
'ExternalSharingMasterId' = $CalLog.ExternalSharingMasterId
'ReceivedBy' = $CalLog.ReceivedBy.SmtpEmailAddress
'ReceivedRepresenting' = $CalLog.ReceivedRepresenting.SmtpEmailAddress
'MeetingRequestType' = $CalLog.MeetingRequestType.ToString()
Expand All @@ -205,7 +204,6 @@ function BuildCSV {
'SendMeetingMessagesDiagnostics' = $CalLog.SendMeetingMessagesDiagnostics
'AttendeeCollection' = MultiLineFormat($CalLog.AttendeeCollection)
'CalendarLogRequestId' = $CalLog.CalendarLogRequestId.ToString() # Move to front.../ Format in groups???
'CleanGlobalObjectId' = $CalLog.CleanGlobalObjectId
}
}
$script:EnhancedCalLogs = $GCDOResults
Expand Down
3 changes: 2 additions & 1 deletion Calendar/CalLogHelpers/CalLogInfoFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function SetLogType {
$ShortClientName -eq "CalendarReplication" -or
$CalendarItemTypes.($CalLog.ItemClass) -eq "SharingCFM" -or
$CalendarItemTypes.($CalLog.ItemClass) -eq "SharingDelete") {
return "Sharing"
return "Sync"
} elseif ($ShortClientName -eq "Other EBA" -or
$ShortClientName -eq "Other TBA" -or
$ShortClientName -eq "LocationProcessor" -or
Expand All @@ -129,6 +129,7 @@ function SetLogType {
return "Exception"
} elseif (($CalendarItemTypes.($CalLog.ItemClass) -like "*Resp*" -and $CalLog.CalendarLogTriggerAction -ne "Create" ) -or
$CalendarItemTypes.($CalLog.ItemClass) -eq "AttendeeList" -or
($CalendarItemTypes.($CalLog.ItemClass) -eq "Forward.Notification" -and ($CalLog.CalendarLogTriggerAction -eq "SoftDelete") -or $CalLog.CalendarLogTriggerAction -like "*move*") -or
($CalLog.ItemClass -eq "IPM.Schedule.Meeting.Request" -and $CalLog.CalendarLogTriggerAction -like "*move*" ) ) {
return "Cleanup"
} else {
Expand Down
20 changes: 8 additions & 12 deletions Calendar/CalLogHelpers/ExportToExcelFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,19 @@ $ConditionalFormatting = $(
# Client, ShortClientInfoString and LogClientInfoString
New-ConditionalText "Outlook" -ConditionalTextColor Green -BackgroundColor $null
New-ConditionalText "OWA" -ConditionalTextColor DarkGreen -BackgroundColor $null
New-ConditionalText "Teams" -ConditionalTextColor DarkGreen -BackgroundColor $null
New-ConditionalText "Transport" -ConditionalTextColor Blue -BackgroundColor $null
New-ConditionalText "Repair" -ConditionalTextColor DarkRed -BackgroundColor LightPink
New-ConditionalText "Other ?BA" -ConditionalTextColor Orange -BackgroundColor $null
New-ConditionalText "TimeService" -ConditionalTextColor Orange -BackgroundColor $null
New-ConditionalText "Other REST" -ConditionalTextColor DarkRed -BackgroundColor $null
New-ConditionalText "[Unknown Rest Client]" -ConditionalTextColor DarkRed -BackgroundColor $null
New-ConditionalText "ResourceBookingAssistant" -ConditionalTextColor Blue -BackgroundColor $null

#LogType
New-ConditionalText -Range "C3:C9999" -ConditionalType ContainsText -Text "Ignorable" -ConditionalTextColor DarkRed -BackgroundColor $null
New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "Cleanup" -ConditionalTextColor DarkRed -BackgroundColor $null
New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "Sharing" -ConditionalTextColor Blue -BackgroundColor $null
New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "Sync" -ConditionalTextColor Blue -BackgroundColor $null

# TriggerAction
New-ConditionalText -Range "G:G" -ConditionalType ContainsText -Text "Create" -ConditionalTextColor Green -BackgroundColor $null
Expand All @@ -90,17 +93,16 @@ $ConditionalFormatting = $(

#Shared Calendar information
New-ConditionalText -Range "Q3:Q9999" -ConditionalType NotEqual -Text "Not Shared" -ConditionalTextColor Blue -BackgroundColor $null
New-ConditionalText -Range "R:R" -ConditionalType ContainsText -Text "TRUE" -ConditionalTextColor Blue -BackgroundColor $null
New-ConditionalText -Range "S:S" -ConditionalType NotEqual -Text "NotFound" -ConditionalTextColor Blue -BackgroundColor $null

#MeetingRequestType
New-ConditionalText -Range "V:V" -ConditionalType ContainsText -Text "Outdated" -ConditionalTextColor DarkRed -BackgroundColor LightPink
New-ConditionalText -Range "T:T" -ConditionalType ContainsText -Text "Outdated" -ConditionalTextColor DarkRed -BackgroundColor LightPink

#AppointmentAuxiliaryFlags
New-ConditionalText -Range "AE3:AE9999" -ConditionalType ContainsText -Text "Copied" -ConditionalTextColor DarkRed -BackgroundColor LightPink
New-ConditionalText -Range "AC3:AC9999" -ConditionalType ContainsText -Text "Copied" -ConditionalTextColor DarkRed -BackgroundColor LightPink
New-ConditionalText -Range "AC3:AC9999" -ConditionalType ContainsText -Text "ForwardedAppointment" -ConditionalTextColor DarkRed -BackgroundColor $null

#ResponseType
New-ConditionalText -Range "AI3:AI9999" -ConditionalType ContainsText -Text "Organizer" -ConditionalTextColor Orange -BackgroundColor $null
New-ConditionalText -Range "AG3:AG9999" -ConditionalType ContainsText -Text "Organizer" -ConditionalTextColor Orange -BackgroundColor $null
)

function FormatHeader {
Expand Down Expand Up @@ -146,10 +148,6 @@ function FormatHeader {
Set-CellComment -Text "OriginalLogFolder (OriginalParentDisplayName): The Original Log Folder that the item was in / delivered to." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet
$sheet.Column(++$n) | Set-ExcelRange -Width 15 -HorizontalAlignment Right # SharedFolderName
Set-CellComment -Text "SharedFolderName: Was this from a Modern Sharing, and if so what Folder." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet
$sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # IsFromSharedCalendar
Set-CellComment -Text "IsFromSharedCalendar: Is this CalLog from a Modern Sharing relationship?" -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet
$sheet.Column(++$n) | Set-ExcelRange -Width 20 -HorizontalAlignment Left # ExternalSharingMasterId
Set-CellComment -Text "ExternalSharingMasterId: If this is not [NotFound], then it is from a Modern Sharing relationship." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet
$sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Left # ReceivedBy
Set-CellComment -Text "ReceivedBy: The Receiver of the Calendar Item. Should always be the owner of the Mailbox." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet
$sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Left # ReceivedRepresenting
Expand Down Expand Up @@ -200,8 +198,6 @@ function FormatHeader {
Set-CellComment -Text "AttendeeCollection: The Attendee Collection of the Meeting, use -TrackingLogs to get values." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet
$sheet.Column(++$n) | Set-ExcelRange -Width 40 -HorizontalAlignment Center # CalendarLogRequestId
Set-CellComment -Text "CalendarLogRequestId: The Calendar Log Request ID of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet
$sheet.Column(++$n) | Set-ExcelRange -Width 120 -HorizontalAlignment Left # CleanGlobalObjectId
Set-CellComment -Text "CleanGlobalObjectId: The Clean Global Object ID of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet

# Update header rows after all the others have been set.
# Title Row
Expand Down
5 changes: 5 additions & 0 deletions Calendar/CalLogHelpers/Invoke-GetCalLogs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ $script:CustomPropertyNameList =
"FreeBusyStatus",
"From",
"HasAttachment",
"InternetMessageId",
"ItemID",
"IsAllDayEvent",
"IsCancelled",
Expand All @@ -39,6 +40,10 @@ $script:CustomPropertyNameList =

$LogLimit = 2000

if ($ShortLogs.IsPresent) {
$LogLimit = 500
}

<#
.SYNOPSIS
Run Get-CalendarDiagnosticObjects for passed in User with Subject or MeetingID.
Expand Down
2 changes: 1 addition & 1 deletion Calendar/CalLogHelpers/Invoke-GetMailbox.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function GetSMTPAddress {
return $PassedCN
} else {
# We have a problem, we don't have a CN or an SMTP Address
Write-Error "GetSMTPAddress: Passed in Value does not look like a CN or SMTP Address: [$PassedCN]"
Write-Warning "GetSMTPAddress: Passed in Value does not look like a CN or SMTP Address: [$PassedCN]"
return $PassedCN
}
}
Expand Down
4 changes: 3 additions & 1 deletion Calendar/CalLogHelpers/ShortClientNameFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function FindMatch {

$ShortClientNameProcessor = @{
'Client=Hub Transport' = "Transport"
'Client=MSExchangeRPC' = "Outlook : Desktop : MAPI"
'Client=MSExchangeRPC' = "Outlook:Desktop:MAPI"
'OneOutlook' = "NewOutlook"
'Lync for Mac' = "LyncMac"
'MicrosoftNinja' = "Teams"
Expand Down Expand Up @@ -119,6 +119,8 @@ function CreateShortClientName {
$LogClientInfoString -like "*43375d74-c6a5-4d4e-a0a3-de139860ea75*" -or
$LogClientInfoString -like "*af9fc99a-5ae5-46e1-bbd7-fa25088e16c9*") {
$ShortClientName = "ELC-B2"
} elseif ($LogClientInfoString -like "*AppId=de8bc8b5-d9f9-48b1-a8ad-b748da725064*") {
$ShortClientName = "GraphExplorer"
} elseif ($LogClientInfoString -like "*Outlook-iOS*") {
$ShortClientName = "OutlookiOS"
} elseif ($LogClientInfoString -like "*Outlook-Android*") {
Expand Down
2 changes: 1 addition & 1 deletion Calendar/CalLogHelpers/TimelineFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function BuildTimeline {
FindOrganizer($script:FirstLog)

# Ignorable and items from Shared Calendars are not included in the TimeLine.
[array]$InterestingCalLogs = $script:EnhancedCalLogs | Where-Object { $_.LogType -eq "Core" -and $_.IsFromSharedCalendar -eq $False }
[array]$InterestingCalLogs = $script:EnhancedCalLogs | Where-Object { $_.LogType -eq "Core" -and $_.SharedFolderName -eq "Not Shared" }

if ($InterestingCalLogs.count -eq 0) {
Write-Host "All CalLogs are Ignorable, nothing to create a timeline with, displaying initial values."
Expand Down
8 changes: 4 additions & 4 deletions Calendar/Tests/ShortClientNameFunctions.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Describe "CreateShortClientName" {
}

Context "When LogClientInfoString is Client=MSExchangeRPC" {
It "Should return 'Outlook : Desktop : MAPI'" {
It "Should return 'Outlook:Desktop:MAPI'" {
$result = CreateShortClientName -LogClientInfoString "Client=MSExchangeRPC"
$result | Should -Be "Outlook : Desktop : MAPI"
$result | Should -Be "Outlook:Desktop:MAPI"
}
}

Context "When LogClientInfoString is Client=WebServices;Microsoft Office/16.0 (Windows NT 10.0; Microsoft Outlook 16.0.17328; Pro);;Client=WebServices;ExchangeServicesClient/0.9.248.0;" {
It "Should return 'Outlook : Desktop : MAPI' if LogClientInfoString FileContentMatch 'AppId=bcad1a65-78eb-4725-9bce-ce1a8ed30b95'" {
It "Should return 'Outlook:Desktop:MAPI' if LogClientInfoString FileContentMatch 'AppId=bcad1a65-78eb-4725-9bce-ce1a8ed30b95'" {
$result = CreateShortClientName "Client=WebServices;Microsoft Office/16.0 (Windows NT 10.0; Microsoft Outlook 16.0.17328; Pro);;Client=WebServices;ExchangeServicesClient/0.9.248.0;"
$result | Should -Be "Outlook : Desktop"
}
Expand Down Expand Up @@ -169,7 +169,7 @@ Describe "CreateShortClientName-FindMatch" {

Context 'Test CreateShortClientName focusing on the FindMatch function' -ForEach @(
@{ LogClientInfoString = 'Client=Hub Transport'; Expected = "Transport" },
@{ LogClientInfoString = 'Client=MSExchangeRPC'; Expected = "Outlook : Desktop : MAPI" },
@{ LogClientInfoString = 'Client=MSExchangeRPC'; Expected = "Outlook:Desktop:MAPI" },
@{ LogClientInfoString = 'OneOutlook'; Expected = "NewOutlook" },
@{ LogClientInfoString = 'Lync for Mac'; Expected = "LyncMac" },
@{ LogClientInfoString = 'AppId=00000004-0000-0ff1-ce00-000000000000'; Expected = "SkypeMMS" },
Expand Down

0 comments on commit b38113f

Please sign in to comment.