diff --git a/Calendar/CalLogHelpers/CalLogCSVFunctions.ps1 b/Calendar/CalLogHelpers/CalLogCSVFunctions.ps1 index e5e783c38..18b9935d1 100644 --- a/Calendar/CalLogHelpers/CalLogCSVFunctions.ps1 +++ b/Calendar/CalLogHelpers/CalLogCSVFunctions.ps1 @@ -102,7 +102,7 @@ function CreateExternalMasterIDMap { foreach ($Key in $SharedFolders.Keys) { Write-Host -ForegroundColor Green "$Key : $($SharedFolders[$Key])" } - # ToDo: Need to check for multiple ExternalMasterIDs pointing to the same FolderName + # ToDo: Need to check for multiple ExternalSharingMasterId pointing to the same FolderName Write-Verbose "Created the following Mapping :" Write-Verbose $SharedFolders } @@ -131,7 +131,6 @@ function BuildCSV { Write-Host "Starting to Process Calendar Logs..." $GCDOResults = @() - $LogType = @() $script:MailboxList = @{} Write-Host "Creating Map of Mailboxes to CNs..." CreateExternalMasterIDMap @@ -144,9 +143,6 @@ function BuildCSV { $Index++ $ItemType = $CalendarItemTypes.($CalLog.ItemClass) - $ShortClientName = CreateShortClientName($CalLog.LogClientInfoString) - $LogType = SetLogType($CalLog) - # CleanNotFounds $PropsToClean = "FreeBusyStatus", "ClientIntent", "AppointmentSequenceNumber", "AppointmentLastSequenceNumber", "RecurrencePattern", "AppointmentAuxiliaryFlags", "EventEmailReminderTimer", "IsSeriesCancelled", "AppointmentCounterProposal", "MeetingRequestType", "SendMeetingMessagesDiagnostics" foreach ($Prop in $PropsToClean) { @@ -160,9 +156,9 @@ function BuildCSV { $GCDOResults += [PSCustomObject]@{ 'LogRow' = $Index 'LogTimestamp' = ConvertDateTime($CalLog.LogTimestamp) - 'LogType' = $LogType + 'LogRowType' = $CalLog.LogRowType.ToString() 'SubjectProperty' = $CalLog.SubjectProperty - 'Client' = $ShortClientName + 'Client' = $CalLog.ShortClientInfoString 'LogClientInfoString' = $CalLog.LogClientInfoString 'TriggerAction' = $CalLog.CalendarLogTriggerAction 'ItemClass' = $ItemType diff --git a/Calendar/CalLogHelpers/CalLogInfoFunctions.ps1 b/Calendar/CalLogHelpers/CalLogInfoFunctions.ps1 index 33f7eeac9..1e0f4f54c 100644 --- a/Calendar/CalLogHelpers/CalLogInfoFunctions.ps1 +++ b/Calendar/CalLogHelpers/CalLogInfoFunctions.ps1 @@ -100,39 +100,3 @@ function CheckForBifurcation { return $IsBifurcated } -<# -.SYNOPSIS -Sets the Calendar Log Type. -Many updates are not interesting in the Calendar Log, marking these as ignorable. 99% of the time this is correct. -#> -function SetLogType { - param( - $CalLog - ) - - if ($CalLog.ItemClass -eq "(Occurrence Deleted)") { - return "Ignorable" - } elseif ($ShortClientName -like "CalendarSyncAssistant" -or - $ShortClientName -eq "CalendarReplication" -or - $CalendarItemTypes.($CalLog.ItemClass) -eq "SharingCFM" -or - $CalendarItemTypes.($CalLog.ItemClass) -eq "SharingDelete") { - return "Sync" - } elseif ($ShortClientName -eq "Other EBA" -or - $ShortClientName -eq "Other TBA" -or - $ShortClientName -eq "LocationProcessor" -or - $ShortClientName -eq "GriffinRestClient" -or - $ShortClientName -eq "RestConnector" -or - $ShortClientName -eq "ELC-B2" -or - $ShortClientName -eq "TimeService" ) { - return "Ignorable" - } 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 - ($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 { - return "Core" - } -} diff --git a/Calendar/CalLogHelpers/ExportToExcelFunctions.ps1 b/Calendar/CalLogHelpers/ExportToExcelFunctions.ps1 index af442f5f6..0e45c5876 100644 --- a/Calendar/CalLogHelpers/ExportToExcelFunctions.ps1 +++ b/Calendar/CalLogHelpers/ExportToExcelFunctions.ps1 @@ -114,16 +114,20 @@ $ConditionalFormatting = $( New-ConditionalText "Other REST" -ConditionalTextColor DarkRed -BackgroundColor $null New-ConditionalText "Unknown" -ConditionalTextColor DarkRed -BackgroundColor $null New-ConditionalText "ResourceBookingAssistant" -ConditionalTextColor Blue -BackgroundColor $null + New-ConditionalText "Calendar Replication" -ConditionalTextColor Blue -BackgroundColor $null - #LogType -Would like to Hide "Ignorable" and "Cleanup" rows by default. - New-ConditionalText -Range "C3:C9999" -ConditionalType ContainsText -Text "Ignorable" -ConditionalTextColor Orange -BackgroundColor $null - New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "Cleanup" -ConditionalTextColor Orange -BackgroundColor $null - New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "Sync" -ConditionalTextColor Blue -BackgroundColor $null - New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "Core" -ConditionalTextColor Green -BackgroundColor $null + # LogRowType + New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "Interesting" -ConditionalTextColor Green -BackgroundColor $null + New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "SeriesException" -ConditionalTextColor Green -BackgroundColor $null + New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "DeletedSeriesException" -ConditionalTextColor Orange -BackgroundColor $null + New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "MeetingMessageChange" -ConditionalTextColor Orange -BackgroundColor $null + New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "SyncOrReplication" -ConditionalTextColor Blue -BackgroundColor $null + New-ConditionalText -Range "C:C" -ConditionalType ContainsText -Text "OtherAssistant" -ConditionalTextColor Orange -BackgroundColor $null # TriggerAction New-ConditionalText -Range "G:G" -ConditionalType ContainsText -Text "Create" -ConditionalTextColor Green -BackgroundColor $null New-ConditionalText -Range "G:G" -ConditionalType ContainsText -Text "Delete" -ConditionalTextColor Red -BackgroundColor $null + # ItemClass New-ConditionalText -Range "H:H" -ConditionalType ContainsText -Text "IPM.Appointment" -ConditionalTextColor Blue -BackgroundColor $null New-ConditionalText -Range "H:H" -ConditionalType ContainsText -Text "Cancellation" -ConditionalTextColor Black -BackgroundColor Orange @@ -131,26 +135,26 @@ $ConditionalFormatting = $( New-ConditionalText -Range "H:H" -ConditionalType ContainsText -Text ".Resp." -ConditionalTextColor Orange -BackgroundColor $null New-ConditionalText -Range "H:H" -ConditionalType ContainsText -Text "IPM.OLE.CLASS" -ConditionalTextColor Plum -BackgroundColor $null - #FreeBusyStatus + # FreeBusyStatus New-ConditionalText -Range "L3:L9999" -ConditionalType ContainsText -Text "Free" -ConditionalTextColor Red -BackgroundColor $null New-ConditionalText -Range "L3:L9999" -ConditionalType ContainsText -Text "Tentative" -ConditionalTextColor Orange -BackgroundColor $null New-ConditionalText -Range "L3:L9999" -ConditionalType ContainsText -Text "Busy" -ConditionalTextColor Green -BackgroundColor $null - #Shared Calendar information + # Shared Calendar information New-ConditionalText -Range "Q3:Q9999" -ConditionalType Equal -Text "Not Shared" -ConditionalTextColor Blue -BackgroundColor $null New-ConditionalText -Range "Q3:Q9999" -ConditionalType Equal -Text "TRUE" -ConditionalTextColor Blue -BackgroundColor Orange - #MeetingRequestType + # MeetingRequestType New-ConditionalText -Range "T:T" -ConditionalType ContainsText -Text "Outdated" -ConditionalTextColor DarkRed -BackgroundColor LightPink - #CalendarItemType + # CalendarItemType New-ConditionalText -Range "AA3:AA9999" -ConditionalType ContainsText -Text "RecurringMaster" -ConditionalTextColor $null -BackgroundColor Plum - #AppointmentAuxiliaryFlags + # AppointmentAuxiliaryFlags New-ConditionalText -Range "AD3:AD9999" -ConditionalType ContainsText -Text "Copied" -ConditionalTextColor DarkRed -BackgroundColor LightPink New-ConditionalText -Range "AC3:AC9999" -ConditionalType ContainsText -Text "ForwardedAppointment" -ConditionalTextColor DarkRed -BackgroundColor $null - #ResponseType + # ResponseType New-ConditionalText -Range "AG3:AG9999" -ConditionalType ContainsText -Text "Organizer" -ConditionalTextColor Orange -BackgroundColor $null ) @@ -163,29 +167,29 @@ function FormatHeader { $n = 0 # Static List of Columns for now... - $sheet.Column(++$n) | Set-ExcelRange -Width 6 -HorizontalAlignment center # LogRow + $sheet.Column(++$n) | Set-ExcelRange -Width 6 -HorizontalAlignment Center # LogRow Set-CellComment -Text "This is the Enhanced Calendar Logs for [$Identity] for MeetingID `n [$($script:GCDO[0].CleanGlobalObjectId)]." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 20 -NumberFormat "m/d/yyyy h:mm:ss" -HorizontalAlignment center #LogTimestamp + $sheet.Column(++$n) | Set-ExcelRange -Width 20 -NumberFormat "m/d/yyyy h:mm:ss" -HorizontalAlignment Center #LogTimestamp Set-CellComment -Text "LogTimestamp: Time when the change was recorded in the CalLogs. This and all Times are in UTC." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 11 -HorizontalAlignment center # LogType - Set-CellComment -Text "LogType: Core logs are what to focus on, to start with, filter all the others out." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet + $sheet.Column(++$n) | Set-ExcelRange -Width 20 -HorizontalAlignment Left # LogRowType + Set-CellComment -Text "LogRowType: Interesting logs are what to focus on, filter all the others out to start with." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 20 -HorizontalAlignment Left # SubjectProperty Set-CellComment -Text "SubjectProperty: The Subject of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 20 -HorizontalAlignment Left # Client Set-CellComment -Text "Client (ShortClientInfoString): The 'friendly' Client name of the client that made the change." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 5 -HorizontalAlignment Left # LogClientInfoString + $sheet.Column(++$n) | Set-ExcelRange -Width 5 -HorizontalAlignment Left # LogClientInfoString Set-CellComment -Text "LogClientInfoString: Full Client Info String of client that made the change." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 12 -HorizontalAlignment Center # TriggerAction + $sheet.Column(++$n) | Set-ExcelRange -Width 12 -HorizontalAlignment Center # TriggerAction Set-CellComment -Text "TriggerAction (CalendarLogTriggerAction): The type of action that caused the change." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 18 -HorizontalAlignment Left # ItemClass Set-CellComment -Text "ItemClass: The Class of the Calendar Item" -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # Seq:Exp:ItemVersion + $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Center # Seq:Exp:ItemVersion Set-CellComment -Text "Seq:Exp:ItemVersion (AppointmentLastSequenceNumber:AppointmentSequenceNumber:ItemVersion): The Sequence Version, the Exception Version, and the Item Version. Each type of item has its own count." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 20 -HorizontalAlignment Left # Organizer Set-CellComment -Text "Organizer (From.FriendlyDisplayName): The Organizer of the Calendar Item." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 20 -HorizontalAlignment Left # From Set-CellComment -Text "From: The SMTP address of the Organizer of the Calendar Item." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 12 -HorizontalAlignment center # FreeBusyStatus + $sheet.Column(++$n) | Set-ExcelRange -Width 12 -HorizontalAlignment Center # FreeBusyStatus Set-CellComment -Text "FreeBusy (FreeBusyStatus): The FreeBusy Status of the Calendar Item." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 20 -HorizontalAlignment Left # ResponsibleUser Set-CellComment -Text "ResponsibleUser(ResponsibleUserName): The Responsible User of the change." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet @@ -201,11 +205,11 @@ function FormatHeader { 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 Set-CellComment -Text "ReceivedRepresenting: Who the item was Received for, of then the Delegate." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # MeetingRequestType + $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Center # MeetingRequestType Set-CellComment -Text "MeetingRequestType: The Meeting Request Type of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 23 -NumberFormat "m/d/yyyy h:mm:ss" -HorizontalAlignment center # StartTime + $sheet.Column(++$n) | Set-ExcelRange -Width 23 -NumberFormat "m/d/yyyy h:mm:ss" -HorizontalAlignment Center # StartTime Set-CellComment -Text "StartTime: The Start Time of the Meeting. This and all Times are in UTC." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 23 -NumberFormat "m/d/yyyy h:mm:ss" -HorizontalAlignment center # EndTime + $sheet.Column(++$n) | Set-ExcelRange -Width 23 -NumberFormat "m/d/yyyy h:mm:ss" -HorizontalAlignment Center # EndTime Set-CellComment -Text "EndTime: The End Time of the Meeting. This and all Times are in UTC." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 17 -NumberFormat "m/d/yyyy h:mm:ss" -HorizontalAlignment Left # OriginalStartDate Set-CellComment -Text "OriginalStartDate: The Original Start Date of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet @@ -213,9 +217,9 @@ function FormatHeader { Set-CellComment -Text "TimeZone: The Time Zone of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Left # Location Set-CellComment -Text "Location: The Location of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # CalendarItemType + $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Center # CalendarItemType Set-CellComment -Text "CalendarItemType: The Calendar Item Type of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # IsException + $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Center # IsException Set-CellComment -Text "IsException: Is this an Exception?" -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 20 -HorizontalAlignment Left # RecurrencePattern Set-CellComment -Text "RecurrencePattern: The Recurrence Pattern of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet @@ -223,23 +227,23 @@ function FormatHeader { Set-CellComment -Text "AppointmentAuxiliaryFlags: The Appointment Auxiliary Flags of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 30 -HorizontalAlignment Left # DisplayAttendeesAll Set-CellComment -Text "DisplayAttendeesAll: List of the Attendees of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # AttendeeCount + $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Center # AttendeeCount Set-CellComment -Text "AttendeeCount: The Attendee Count." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 20 -HorizontalAlignment Left # AppointmentState Set-CellComment -Text "AppointmentState: The Appointment State of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # ResponseType + $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Center # ResponseType Set-CellComment -Text "ResponseType: The Response Type of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 20 -HorizontalAlignment center # ClientIntent + $sheet.Column(++$n) | Set-ExcelRange -Width 20 -HorizontalAlignment Center # ClientIntent Set-CellComment -Text "ClientIntent: The Client Intent of the Meeting." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # AppointmentRecurring + $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Center # AppointmentRecurring Set-CellComment -Text "AppointmentRecurring: Is this a Recurring Meeting?" -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # HasAttachment + $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Center # HasAttachment Set-CellComment -Text "HasAttachment: Does this Meeting have an Attachment?" -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # IsCancelled + $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Center # IsCancelled Set-CellComment -Text "IsCancelled: Is this Meeting Cancelled?" -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # IsAllDayEvent + $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Center # IsAllDayEvent Set-CellComment -Text "IsAllDayEvent: Is this an All Day Event?" -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet - $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment center # IsSeriesCancelled + $sheet.Column(++$n) | Set-ExcelRange -Width 10 -HorizontalAlignment Center # IsSeriesCancelled Set-CellComment -Text "IsSeriesCancelled: Is this a Series Cancelled Meeting?" -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet $sheet.Column(++$n) | Set-ExcelRange -Width 30 -HorizontalAlignment Left # SendMeetingMessagesDiagnostics Set-CellComment -Text "SendMeetingMessagesDiagnostics: Compound Property to describe why meeting was or was not sent to everyone." -Row $HeaderRow -ColumnNumber $n -Worksheet $sheet @@ -251,7 +255,7 @@ function FormatHeader { # Update header rows after all the others have been set. # Title Row $sheet.Row(1) | Set-ExcelRange -HorizontalAlignment Left - Set-CellComment -Text "For more information see: https://learn.microsoft.com/en-us/exchange/troubleshoot/calendars/analyze-calendar-diagnostic-logs." -Row 1 -ColumnNumber 1 -Worksheet $sheet + Set-CellComment -Text "For more information see: Https:\\aka.ms\AnalyzeCalLogs" -Row 1 -ColumnNumber 1 -Worksheet $sheet # Set the Header row to be bold and left aligned $sheet.Row($HeaderRow) | Set-ExcelRange -Bold -HorizontalAlignment Left diff --git a/Calendar/CalLogHelpers/FindChangedPropFunctions.ps1 b/Calendar/CalLogHelpers/FindChangedPropFunctions.ps1 index 698b49d87..28f071d33 100644 --- a/Calendar/CalLogHelpers/FindChangedPropFunctions.ps1 +++ b/Calendar/CalLogHelpers/FindChangedPropFunctions.ps1 @@ -11,7 +11,7 @@ Changed properties will be added to the Timeline. #> function FindChangedProperties { - if ($CalLog.Client -ne "LocationProcessor" -or $CalLog.Client -notlike "EBA:*" -or $CalLog.Client -notlike "TBA:*") { + if ($CalLog.Client -ne "LocationProcessor" -or $CalLog.Client -notlike "*EBA*" -or $CalLog.Client -notlike "*TBA*") { if ($script:PreviousCalLog -and $script:AddChangedProperties) { if ($CalLog.StartTime.ToString() -ne $script:PreviousCalLog.StartTime.ToString()) { [Array]$TimeLineText = "The StartTime changed from [$($script:PreviousCalLog.StartTime)] to: [$($CalLog.StartTime)]" diff --git a/Calendar/CalLogHelpers/Invoke-GetCalLogs.ps1 b/Calendar/CalLogHelpers/Invoke-GetCalLogs.ps1 index a8e087961..473ba6432 100644 --- a/Calendar/CalLogHelpers/Invoke-GetCalLogs.ps1 +++ b/Calendar/CalLogHelpers/Invoke-GetCalLogs.ps1 @@ -10,10 +10,11 @@ $script:CustomPropertyNameList = "AppointmentLastSequenceNumber", "AppointmentRecurring", "CalendarItemType", +"CalendarLogTriggerAction", "CalendarProcessed", -"ClientIntent", "ChangeList", -"CalendarLogTriggerAction", +"ClientIntent", +"CreationTime", "DisplayAttendeesCc", "DisplayAttendeesTo", "EventEmailReminderTimer", @@ -22,20 +23,22 @@ $script:CustomPropertyNameList = "From", "HasAttachment", "InternetMessageId", -"ItemID", "IsAllDayEvent", "IsCancelled", "IsMeeting", "IsOrganizerProperty", +"IsSharedInEvent", +"ItemID", +"LogClientInfoString", +"LogRowType", +"LogTimestamp", "NormalizedSubject", +"OriginalStartDate", "SendMeetingMessagesDiagnostics", +"Sensitivity", "SentRepresentingDisplayName", "SentRepresentingEmailAddress", -"Sensitivity", -"LogTimestamp", -"LogClientInfoString", -"OriginalStartDate", -"CreationTime", +"ShortClientInfoString", "TimeZone" $LogLimit = 2000 @@ -63,6 +66,7 @@ function GetCalendarDiagnosticObjects { MaxResults = $LogLimit ResultSize = $LogLimit ShouldBindToItem = $true + ShouldDecodeEnums = $true } if ($TrackingLogs.IsPresent) { diff --git a/Calendar/CalLogHelpers/ShortClientNameFunctions.ps1 b/Calendar/CalLogHelpers/ShortClientNameFunctions.ps1 deleted file mode 100644 index 36ba1d591..000000000 --- a/Calendar/CalLogHelpers/ShortClientNameFunctions.ps1 +++ /dev/null @@ -1,178 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -# =================================================================================================== -# Functions to support the script -# =================================================================================================== -function FindMatch { - param( - # [HashTable] $ShortClientNameProcessor, - [string] $KeyInput - ) - foreach ($Val in $ShortClientNameProcessor.keys) { - if ($KeyInput -like "*$Val*") { - return $ShortClientNameProcessor[$Val] - } - } -} - -$ShortClientNameProcessor = @{ - 'Client=Hub Transport' = "Transport" - 'Client=MSExchangeRPC' = "Outlook:Desktop:MAPI" - 'OneOutlook' = "NewOutlook" - 'Lync for Mac' = "LyncMac" - 'MicrosoftNinja' = "Teams" - 'SkypeSpaces' = "Teams" - 'Remove-CalendarEvents' = "RemoveCalendarEvent" - 'Client=POP3/IMAP4' = "PopImap" - 'Client=OWA' = "OWA" - 'PublishedBookingCalendar' = "BookingAgent" - 'LocationAssistantProcessor' = "LocationProcessor" - 'AppId=6326e366-9d6d-4c70-b22a-34c7ea72d73d' = "CalendarReplication" - 'AppId=1e3faf23-d2d2-456a-9e3e-55db63b869b0' = "CiscoWebex" - 'AppId=1c3a76cc-470a-46d7-8ba9-713cfbb2c01f' = "Time Service" - 'AppId=48af08dc-f6d2-435f-b2a7-069abd99c086' = "RestConnector" - 'AppId=7b7fdad6-df9d-4cd5-a4f2-b5f749350419' = "Bookings B2 Service" - 'AppId=82f45fb0-18b4-4d68-8bed-9e44909e3890' = "SkypeMMS" - 'AppId=00000004-0000-0ff1-ce00-000000000000' = "SkypeMMS" - 'GriffinRestClient' = "GriffinRestClient" - 'MacOutlook' = "MacOutlookRest" - 'Outlook-iOS-Android' = "OutlookMobile" - 'Client=OutlookService;Outlook-Android' = "OutlookAndroid" - 'Client=OutlookService;Outlook-iOS' = "OutlookiOS" -} - -<# -.SYNOPSIS -Creates friendly / short client names from the LogClientInfoString -#> -function CreateShortClientName { - param( - $LogClientInfoString - ) - $ShortClientName= "" - - # Map LogClientInfoString to ShortClientName - if ([string]::IsNullOrEmpty($LogClientInfoString)) { - $ShortClientName = "NotFound" - return $ShortClientName - } - - if ($LogClientInfoString -like "*EDiscoverySearch*") { - $ShortClientName = "EDiscoverySearch" - return $ShortClientName - } - - if ($LogClientInfoString -like "*AppId=00000007-0000-0000-c000-000000000000*") { - $ShortClientName = "CRM" - return $ShortClientName - } - - if ($LogClientInfoString -like "Client=EBA*" -or $LogClientInfoString -like "Client=TBA*") { - if ($LogClientInfoString -like "*ResourceBookingAssistant*") { - $ShortClientName = "ResourceBookingAssistant" - } elseif ($LogClientInfoString -like "*CalendarRepairAssistant*") { - $ShortClientName = "CalendarRepairAssistant" - } elseif ($LogClientInfoString -like "*SharingSyncAssistant*") { - $ShortClientName = "CalendarSyncAssistant" - } else { - if ($LogClientInfoString -like "*EBA*") { - $ShortClientName = "Other EBA" - } else { - $ShortClientName = "Other TBA" - } - } - } elseif ($LogClientInfoString -like "Client=ActiveSync*") { - if ($LogClientInfoString -match 'UserAgent=(\w*-\w*)') { - $ShortClientName = ($LogClientInfoString -split "UserAgent=")[-1].Split("/")[0] - } elseif ($LogClientInfoString -like "*Outlook-iOS-Android*") { - $ShortClientName = "OutlookMobile" - } else { - $ShortClientName = "ActiveSyncUnknown" - } - } elseif ($LogClientInfoString -like "Client=Rest*") { - if ($LogClientInfoString -like "*LocationAssistantProcessor*") { - $ShortClientName = "LocationProcessor" - } elseif ($LogClientInfoString -like "*AppId=6326e366-9d6d-4c70-b22a-34c7ea72d73d*") { - $ShortClientName = "CalendarReplication" - } elseif ($LogClientInfoString -like "*AppId=1e3faf23-d2d2-456a-9e3e-55db63b869b0*") { - $ShortClientName = "CiscoWebex" - } elseif ($LogClientInfoString -like "*AppId=1c3a76cc-470a-46d7-8ba9-713cfbb2c01f*") { - $ShortClientName = "TimeService" - } elseif ($LogClientInfoString -like "*AppId=48af08dc-f6d2-435f-b2a7-069abd99c086*") { - $ShortClientName = "RestConnector" - } elseif ($LogClientInfoString -like "*Client=OutlookService;Outlook-Android*") { - $ShortClientName = "OutlookAndroid" - } elseif ($LogClientInfoString -like "*GriffinRestClient*") { - $ShortClientName = "GriffinRestClient" - } elseif ($LogClientInfoString -like "*MacOutlook*") { - $ShortClientName = "MacOutlookRest" - } elseif ($LogClientInfoString -like "*Microsoft Outlook 16*") { - $ShortClientName = "Outlook-ModernCalendarSharing" - } elseif ($LogClientInfoString -like "*SkypeSpaces*") { - $ShortClientName = "Teams" - } elseif ($LogClientInfoString -like "*AppId=82f45fb0-18b4-4d68-8bed-9e44909e3890*") { - $ShortClientName = "Teams MMS Service" - } elseif ($LogClientInfoString -like "*AppId=7b7fdad6-df9d-4cd5-a4f2-b5f749350419*") { - $ShortClientName = "Bookings B2 Service" - } elseif ($LogClientInfoString -like "*bcad1a65-78eb-4725-9bce-ce1a8ed30b95*" -or - $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*") { - $ShortClientName = "OutlookAndroid" - } elseif ($LogClientInfoString -like "*NoUserAgent*") { - $ShortClientName = "RestUnknown" - } else { - $ShortClientName = "[Unknown Rest Client]" - } - # Client=WebServices;Mozilla/5.0 (ZoomPresence.Android 8.1.0 x86); - } elseif ($ShortClientName -eq "") { - $ShortClientName = findMatch -KeyInput $LogClientInfoString - } - - # if ($ShortClientName -eq "" -And $LogClientInfoString -like "Client=WebServices*") { - if ($LogClientInfoString -like "Client=WebServices*") { - if ($LogClientInfoString -like "*ZoomPresence*") { - $ShortClientName = "ZoomPresence" - } elseif ($LogClientInfoString -like "*MacOutlook*") { - $ShortClientName = "Outlook : Mac : EWS" - } elseif ($LogClientInfoString -like "*Outlook*") { - $ShortClientName = "Outlook : Desktop" - } elseif ($LogClientInfoString -like "*Ninja*") { - $ShortClientName = "Teams" - } else { - $ShortClientName = "Unknown EWS App" - } - } - - if ($LogClientInfoString -like "*InternalCalendarSharing*" ) { - if ($LogClientInfoString -like "*OWA*" -and - $LogClientInfoString -notlike "*OneOutlook*") { - $ShortClientName = "OWA : REST" - } elseif ($LogClientInfoString -like "*Outlook*" -and - $LogClientInfoString -notlike "*OneOutlook*" -and - $LogClientInfoString -notlike "*Outlook-Android*" -and - $LogClientInfoString -notlike "*Outlook-iOS*") { - $ShortClientName = "Outlook : Desktop : REST" - } elseif ($LogClientInfoString -like "*OneOutlook*") { - $ShortClientName = "NewOutlook" - } - } - - if ($LogClientInfoString -like "Client=ActiveSync*" -and $LogClientInfoString -like "*Outlook*") { - $ShortClientName = "Outlook : ActiveSync" - } - if ($LogClientInfoString -like "*OneOutlook*") { - $ShortClientName = "NewOutlook" - } - if ($ShortClientName -eq "") { - $ShortClientName = "[NoShortNameFound]" - } - - return $ShortClientName -} diff --git a/Calendar/CalLogHelpers/TimelineFunctions.ps1 b/Calendar/CalLogHelpers/TimelineFunctions.ps1 index 7a33eefc7..19e260287 100644 --- a/Calendar/CalLogHelpers/TimelineFunctions.ps1 +++ b/Calendar/CalLogHelpers/TimelineFunctions.ps1 @@ -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 $_.SharedFolderName -eq "Not Shared" } + [array]$InterestingCalLogs = $script:EnhancedCalLogs | Where-Object { $_.LogRowType -eq "Interesting" -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." diff --git a/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 b/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 index 1eae9aa6b..be42a4941 100644 --- a/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 +++ b/Calendar/Get-CalendarDiagnosticObjectsSummary.ps1 @@ -84,8 +84,8 @@ if (Test-ScriptVersion -AutoUpdate -VersionsUrl "https://aka.ms/CL-VersionsUrl" $script:command = $MyInvocation Write-Verbose "The script was started with the following command line:" -Write-Verbose "Name: " $command.MyCommand.name -Write-Verbose "Command Line: " $command.line +Write-Verbose "Name: $($script:command.MyCommand.name)" +Write-Verbose "Command Line: $($script:command.line)" Write-Verbose "Script Version: $BuildVersion" $script:BuildVersion = $BuildVersion @@ -97,7 +97,6 @@ $script:BuildVersion = $BuildVersion . $PSScriptRoot\CalLogHelpers\MeetingSummaryFunctions.ps1 . $PSScriptRoot\CalLogHelpers\Invoke-GetMailbox.ps1 . $PSScriptRoot\CalLogHelpers\Invoke-GetCalLogs.ps1 -. $PSScriptRoot\CalLogHelpers\ShortClientNameFunctions.ps1 . $PSScriptRoot\CalLogHelpers\CalLogInfoFunctions.ps1 . $PSScriptRoot\CalLogHelpers\CalLogExportFunctions.ps1 . $PSScriptRoot\CalLogHelpers\CreateTimelineRow.ps1 @@ -105,6 +104,8 @@ $script:BuildVersion = $BuildVersion . $PSScriptRoot\CalLogHelpers\Write-DashLineBoxColor.ps1 if ($ExportToExcel.IsPresent) { + . $PSScriptRoot\..\Shared\Confirm-Administrator.ps1 + $script:IsAdministrator = Confirm-Administrator . $PSScriptRoot\CalLogHelpers\ExcelModuleInstaller.ps1 . $PSScriptRoot\CalLogHelpers\ExportToExcelFunctions.ps1 } @@ -162,14 +163,13 @@ if (-not ([string]::IsNullOrEmpty($Subject)) ) { if ($LogToExamine.count -gt 100) { Write-Host -ForegroundColor Cyan "`t This is a large number of logs to examine, this may take a while." } - Write-Host -ForegroundColor Cyan "`t Ignore the next [$($LogToExamine.count)] warnings..." $logLeftCount = $LogToExamine.count $ExceptionLogs = $LogToExamine | ForEach-Object { $logLeftCount -= 1 Write-Verbose "Getting Exception Logs for [$($_.ItemId.ObjectId)]" - Get-CalendarDiagnosticObjects -Identity $ID -ItemIds $_.ItemId.ObjectId -ShouldFetchRecurrenceExceptions $true -CustomPropertyNames $CustomPropertyNameList -ShouldBindToItem $true - if ($logLeftCount % 20 -eq 0) { + Get-CalendarDiagnosticObjects -Identity $ID -ItemIds $_.ItemId.ObjectId -ShouldFetchRecurrenceExceptions $true -CustomPropertyNames $CustomPropertyNameList -ShouldBindToItem $true -WarningAction SilentlyContinue + if (($logLeftCount % 10 -eq 0) -and ($logLeftCount -gt 0)) { Write-Host -ForegroundColor Cyan "`t [$($logLeftCount)] logs left to examine..." } } diff --git a/Calendar/Tests/ShortClientNameFunctions.Tests.ps1 b/Calendar/Tests/ShortClientNameFunctions.Tests.ps1 deleted file mode 100644 index b6705a42e..000000000 --- a/Calendar/Tests/ShortClientNameFunctions.Tests.ps1 +++ /dev/null @@ -1,202 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -[CmdletBinding()] -param() - -Describe "CreateShortClientName" { - BeforeAll { - . $PSScriptRoot\..\CalLogHelpers\ShortClientNameFunctions.ps1 - } - - Context "When LogClientInfoString is empty" { - It "Should return 'NotFound'" { - $result = CreateShortClientName -LogClientInfoString "" - $result | Should -Be "NotFound" - } - } - - Context "When LogClientInfoString is Client=MSExchangeRPC" { - It "Should return 'Outlook:Desktop:MAPI'" { - $result = CreateShortClientName -LogClientInfoString "Client=MSExchangeRPC" - $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'" { - $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" - } - } - - Context "When LogClientInfoString is Client=Hub Transport" { - It "Should return 'Transport'" { - $result = CreateShortClientName -LogClientInfoString "Client=Hub Transport" - $result | Should -Be "Transport" - } - } - - Context "When LogClientInfoString is Client=OutlookService;Outlook-iOS/2.0;;Outlook-iOS/2.0" { - It "Should return 'OutlookiOS'" { - $result = CreateShortClientName -LogClientInfoString "Client=OutlookService;Outlook-iOS/2.0;;Outlook-iOS/2.0" - $result | Should -Be "OutlookiOS" - } - } - - Context "When LogClientInfoString is Client=REST;;;Client=REST;InternalCalendarSharing (Client=OutlookService;Outlook-iOS/2.0;)[AppId=1c06531d-b56d-4cfb-8ad0-53c87d70093e];" { - It "Should return 'OutlookiOS'" { - $result = CreateShortClientName -LogClientInfoString "Client=REST;;;Client=REST;InternalCalendarSharing (Client=OutlookService;Outlook-iOS/2.0;)[AppId=1c06531d-b56d-4cfb-8ad0-53c87d70093e];" - $result | Should -Be "OutlookiOS" - } - } - Context "When LogClientInfoString FileContentMatch 'Client=EBA' or 'Client=TBA'" { - It "Should return 'ResourceBookingAssistant' if LogClientInfoString FileContentMatch 'ResourceBookingAssistant'" { - $result = CreateShortClientName "Client=EBA;Action=FreeBusyPublishingAssistant;ResourceBookingAssistant" - $result | Should -Be "ResourceBookingAssistant" - } - - It "Should return 'CalendarRepairAssistant' if LogClientInfoString FileContentMatch 'CalendarRepairAssistant'" { - $result = CreateShortClientName "Client=TBA;Service=MSExchangeMailboxAssistants;Action=CalendarRepairAssistant" - $result | Should -Be "CalendarRepairAssistant" - } - - It "Should return the concatenated client, action, and data if LogClientInfoString does not contain 'ResourceBookingAssistant' or 'CalendarRepairAssistant'" { - $result = CreateShortClientName "Client=EBA;Action=Delete;Data=789" - $result | Should -Be "Other EBA" - } - } - - Context "When LogClientInfoString FileContentMatch 'Client=ActiveSync'" { - It "Should return the user agent if LogClientInfoString FileContentMatch 'UserAgent='" { - $result = CreateShortClientName "Client=ActiveSync;UserAgent=Apple-iPhone9C1/1402.100;Version=160;Action=/Microsoft-Server-ActiveSync/Proxy/default.eas?User=test@Contoso.com&DeviceId=MyTestDevice&DeviceType=iPhone&Cmd=Sync" - $result | Should -Be "Apple-iPhone9C1" - } - - It "Should return the user agent if LogClientInfoString FileContentMatch 'UserAgent='" { - $result = CreateShortClientName "Client=ActiveSync;UserAgent=Android-14/;Action=/Microsoft-Server-ActiveSync/Proxy/default.eas" - $result | Should -Be "Android-14" - } - - It "Should return unknown if the user agent is Blank" { - $result = CreateShortClientName "Client=ActiveSync;UserAgent=;Action=/Microsoft-Server-ActiveSync/default.eas?Cmd=SendMail" - $result | Should -Be "ActiveSyncUnknown" - } - - It "Should return 'Outlook : ActiveSync' if LogClientInfoString FileContentMatch 'Outlook-iOS-Android'" { - $result = CreateShortClientName "Client=ActiveSync;UserAgent=Outlook-iOS-Android/1.0;Action=/Microsoft-Server-ActiveSync/Proxy/default.eas?User=test%40microsoft.com&DeviceId=BF36923991ADFBA9&DeviceType=Outlook&Cmd=SendMail" - $result | Should -Be "Outlook : ActiveSync" - } - - It "Should return 'ActiveSyncUnknown' if LogClientInfoString does not match any conditions" { - $result = CreateShortClientName "Client=ActiveSync;UnknownClient" - $result | Should -Be "ActiveSyncUnknown" - } - } - - Context "When LogClientInfoString FileContentMatch 'Client=Rest'" { - It "Should return 'LocationProcessor' if LogClientInfoString FileContentMatch 'LocationAssistantProcessor'" { - $result = CreateShortClientName "Client=Rest;LocationAssistantProcessor" - $result | Should -Be "LocationProcessor" - } - - It "Should return 'CalendarReplication' if LogClientInfoString FileContentMatch 'AppId=6326e366-9d6d-4c70-b22a-34c7ea72d73d'" { - $result = CreateShortClientName "Client=Rest;AppId=6326e366-9d6d-4c70-b22a-34c7ea72d73d" - $result | Should -Be "CalendarReplication" - } - - It "Should return 'CiscoWebex' if LogClientInfoString FileContentMatch 'AppId=1e3faf23-d2d2-456a-9e3e-55db63b869b0'" { - $result = CreateShortClientName "Client=Rest;AppId=1e3faf23-d2d2-456a-9e3e-55db63b869b0" - $result | Should -Be "CiscoWebex" - } - - It "Should return 'TimeService' if LogClientInfoString FileContentMatch 'AppId=1c3a76cc-470a-46d7-8ba9-713cfbb2c01f'" { - $result = CreateShortClientName "Client=Rest;AppId=1c3a76cc-470a-46d7-8ba9-713cfbb2c01f" - $result | Should -Be "TimeService" - } - - It "Should return 'RestConnector' if LogClientInfoString FileContentMatch 'AppId=48af08dc-f6d2-435f-b2a7-069abd99c086'" { - $result = CreateShortClientName "Client=Rest;AppId=48af08dc-f6d2-435f-b2a7-069abd99c086" - $result | Should -Be "RestConnector" - } - - It "Should return 'Teams' if LogClientInfoString FileContentMatch 'MicrosoftNinja'" { - $result = CreateShortClientName "Client=WebServices;MicrosoftNinja/1.0 Teams/1.0 (ExchangeServicesClient/1.0.0.0) SkypeSpaces/1.0a$*+;" - $result | Should -Be "Teams" - } - - It "Should return 'OutlookAndroid' if LogClientInfoString FileContentMatch 'Client=OutlookService;Outlook-Android'" { - $result = CreateShortClientName "Client=Rest;Client=OutlookService;Outlook-Android" - $result | Should -Be "OutlookAndroid" - } - - It "Should return 'GriffinRestClient' if LogClientInfoString FileContentMatch 'GriffinRestClient'" { - $result = CreateShortClientName "Client=Rest;GriffinRestClient" - $result | Should -Be "GriffinRestClient" - } - - It "Should return 'MacOutlookRest' if LogClientInfoString FileContentMatch 'MacOutlook'" { - $result = CreateShortClientName "Client=Rest;MacOutlook" - $result | Should -Be "MacOutlookRest" - } - - It "Should return 'Outlook-ModernCalendarSharing' if LogClientInfoString FileContentMatch 'Microsoft Outlook 16'" { - $result = CreateShortClientName "Client=Rest;Microsoft Outlook 16" - $result | Should -Be "Outlook-ModernCalendarSharing" - } - - It "Should return 'Teams' if LogClientInfoString FileContentMatch 'SkypeSpaces'" { - $result = CreateShortClientName "Client=Rest;SkypeSpaces" - $result | Should -Be "Teams" - } - - It "Should return 'Bookings B2 Service' if LogClientInfoString FileContentMatch 'AppId=7b7fdad6-df9d-4cd5-a4f2-b5f749350419'" { - $result = CreateShortClientName "Client=Rest;AppId=7b7fdad6-df9d-4cd5-a4f2-b5f749350419" - $result | Should -Be "Bookings B2 Service" - } - - It "Should return 'ELC-B2' if LogClientInfoString FileContentMatch 'AppId=bcad1a65-78eb-4725-9bce-ce1a8ed30b95'" { - $result = CreateShortClientName "Client=Rest;AppId=bcad1a65-78eb-4725-9bce-ce1a8ed30b95" - $result | Should -Be "ELC-B2" - } - } -} - -Describe "CreateShortClientName-FindMatch" { - BeforeAll { - . $PSScriptRoot\..\CalLogHelpers\ShortClientNameFunctions.ps1 - } - - Context 'Test CreateShortClientName focusing on the FindMatch function' -ForEach @( - @{ LogClientInfoString = 'Client=Hub Transport'; Expected = "Transport" }, - @{ 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" }, - @{ LogClientInfoString = 'MicrosoftNinja'; Expected = "Teams" }, - @{ LogClientInfoString = 'SkypeSpaces'; Expected = "Teams" }, - @{ LogClientInfoString = 'Remove-CalendarEvents'; Expected = "RemoveCalendarEvent" }, - @{ LogClientInfoString = 'Client=POP3/IMAP4'; Expected = "PopImap" }, - @{ LogClientInfoString = 'Client=OWA'; Expected = "OWA" }, - @{ LogClientInfoString = 'PublishedBookingCalendar'; Expected = "BookingAgent" }, - @{ LogClientInfoString = 'LocationAssistantProcessor'; Expected = "LocationProcessor" }, - @{ LogClientInfoString = 'AppId=6326e366-9d6d-4c70-b22a-34c7ea72d73d'; Expected = "CalendarReplication" }, - @{ LogClientInfoString = 'AppId=1e3faf23-d2d2-456a-9e3e-55db63b869b0'; Expected = "CiscoWebex" }, - @{ LogClientInfoString = 'AppId=1c3a76cc-470a-46d7-8ba9-713cfbb2c01f'; Expected = "Time Service" }, - @{ LogClientInfoString = 'AppId=48af08dc-f6d2-435f-b2a7-069abd99c086'; Expected = "RestConnector" }, - @{ LogClientInfoString = 'AppId=7b7fdad6-df9d-4cd5-a4f2-b5f749350419'; Expected = "Bookings B2 Service" }, - @{ LogClientInfoString = 'GriffinRestClient'; Expected = "GriffinRestClient" }, - @{ LogClientInfoString = 'MacOutlook'; Expected = "MacOutlookRest" }, - @{ LogClientInfoString = 'Outlook-iOS-Android'; Expected = "OutlookMobile" }, - @{ LogClientInfoString = 'Client=WebServices;Microsoft Office/16.0 (Windows NT 10.0; Microsoft Outlook 16.0.17328; Pro);;Client=WebServices;ExchangeServicesClient/0.9.248.0;;'; Expected = "Outlook : Desktop" }, - @{ LogClientInfoString = 'Client=OutlookService;Outlook-Android'; Expected = "OutlookAndroid" }, - @{ LogClientInfoString = 'Client=REST;;;Client=REST;InternalCalendarSharing (Client=OutlookService;Outlook-Android/2.0;)[AppId=1c06531d-b56d-4cfb-8ad0-53c87d70093e];'; Expected = "OutlookAndroid" }, - @{ LogClientInfoString = 'Client=OutlookService;Outlook-iOS'; Expected = "OutlookiOS" } - - ) { - It 'Should return the expected value' { - $result = CreateShortClientName -LogClientInfoString $LogClientInfoString - $result | Should -Be $Expected - } - } -}