From 0c3e12fbbe316bc22741af599ad0e8021afc90ac Mon Sep 17 00:00:00 2001 From: David Paulson Date: Thu, 1 Aug 2024 12:51:51 -0500 Subject: [PATCH 1/3] Move ProtocolLogs and ConnectivityLogs for each role under one switch --- .../ExchangeLogCollector/ExchangeLogCollector.ps1 | 12 ++++-------- .../Helpers/Test-PossibleCommonScenarios.ps1 | 8 ++++---- docs/Diagnostics/ExchangeLogCollector.md | 12 +++--------- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/Diagnostics/ExchangeLogCollector/ExchangeLogCollector.ps1 b/Diagnostics/ExchangeLogCollector/ExchangeLogCollector.ps1 index 89097c38c2..71b6b27143 100644 --- a/Diagnostics/ExchangeLogCollector/ExchangeLogCollector.ps1 +++ b/Diagnostics/ExchangeLogCollector/ExchangeLogCollector.ps1 @@ -24,18 +24,12 @@ param ( [switch]$ExchangeServerInformation, [switch]$ExMon, [switch]$ExPerfWiz, - [switch]$FrontEndConnectivityLogs, - [switch]$FrontEndProtocolLogs, [switch]$GetVDirs, [switch]$HighAvailabilityLogs, - [switch]$HubConnectivityLogs, - [switch]$HubProtocolLogs, [switch]$IISLogs, [switch]$ImapLogs, [switch]$MailboxAssistantsLogs, - [switch]$MailboxConnectivityLogs, [switch]$MailboxDeliveryThrottlingLogs, - [switch]$MailboxProtocolLogs, [Alias("ManagedAvailability")] [switch]$ManagedAvailabilityLogs, [switch]$MapiLogs, @@ -56,13 +50,16 @@ param ( [switch]$ServerInformation, [switch]$TransportAgentLogs, [switch]$TransportConfig, + [Alias("ConnectivityLogs", "FrontEndConnectivityLogs", "HubConnectivityLogs", "MailboxConnectivityLogs")] + [switch]$TransportConnectivityLogs, + [Alias("ProtocolLogs", "FrontEndProtocolLogs", "HubProtocolLogs", "MailboxProtocolLogs")] + [switch]$TransportProtocolLogs, [switch]$TransportRoutingTableLogs, [switch]$TransportRules, [switch]$WindowsSecurityLogs, [switch]$AllPossibleLogs, [Alias("CollectAllLogsBasedOnDaysWorth")] [bool]$CollectAllLogsBasedOnLogAge = $true, - [switch]$ConnectivityLogs, [switch]$DatabaseFailoverIssue, [Parameter(ParameterSetName = "Worth")] [int]$DaysWorth = 3, @@ -80,7 +77,6 @@ param ( [switch]$OutlookConnectivityIssues, [switch]$PerformanceIssues, [switch]$PerformanceMailFlowIssues, - [switch]$ProtocolLogs, [switch]$ScriptDebug, [bool]$SkipEndCopyOver ) diff --git a/Diagnostics/ExchangeLogCollector/Helpers/Test-PossibleCommonScenarios.ps1 b/Diagnostics/ExchangeLogCollector/Helpers/Test-PossibleCommonScenarios.ps1 index 13bdaf0285..f79fa1c2ad 100644 --- a/Diagnostics/ExchangeLogCollector/Helpers/Test-PossibleCommonScenarios.ps1 +++ b/Diagnostics/ExchangeLogCollector/Helpers/Test-PossibleCommonScenarios.ps1 @@ -31,8 +31,8 @@ function Test-PossibleCommonScenarios { $Script:PowerShellLogs = $true $Script:WindowsSecurityLogs = $true $Script:CollectFailoverMetrics = $true - $Script:ConnectivityLogs = $true - $Script:ProtocolLogs = $true + $Script:TransportConnectivityLogs = $true + $Script:TransportProtocolLogs = $true $Script:MitigationService = $true $Script:MailboxAssistantsLogs = $true } @@ -55,13 +55,13 @@ function Test-PossibleCommonScenarios { $Script:AcceptedRemoteDomain = $true } - if ($ConnectivityLogs) { + if ($TransportConnectivityLogs) { $Script:FrontEndConnectivityLogs = $true $Script:HubConnectivityLogs = $true $Script:MailboxConnectivityLogs = $true } - if ($ProtocolLogs) { + if ($TransportProtocolLogs) { $Script:FrontEndProtocolLogs = $true $Script:HubProtocolLogs = $true $Script:MailboxProtocolLogs = $true diff --git a/docs/Diagnostics/ExchangeLogCollector.md b/docs/Diagnostics/ExchangeLogCollector.md index 9422d86da7..f0a18a24ac 100644 --- a/docs/Diagnostics/ExchangeLogCollector.md +++ b/docs/Diagnostics/ExchangeLogCollector.md @@ -55,7 +55,7 @@ This cmdlet will collect all relevant data regarding IIS Logs (within the last 3 This cmdlet will collect all relevant data regarding Message Tracking Logs and Protocol Logs for the past 3 hours from the servers EXCH1 and EXCH2 and store them at the default location of "C:\MS_Logs_Collection" ``` -.\ExchangeLogCollector.ps1 -Servers EXCH1,EXCH2 -MessageTrackingLogs -ProtocolLogs -LogAge "03:00:00" +.\ExchangeLogCollector.ps1 -Servers EXCH1,EXCH2 -MessageTrackingLogs -TransportProtocolLogs -LogAge "03:00:00" ``` ## Parameters @@ -79,18 +79,12 @@ EWSLogs | Enable to collect EWS Logs. Location: `V15\Logging\HttpProxy\Ews` and ExchangeServerInformation | Enable to collect Exchange Information like Get-ExchangeServer, Get-MailboxServer, etc... This is also collected when `-ServerInformation` is also enabled. ExMon | Enable to collect ExMon data from the server. ExPerfWiz | Enable to collect ExPerfWiz data if found. -FrontEndConnectivityLogs | Enable to collect the connectivity logging on the FE. Location: `(Get-FrontendTransportService $server).ConnectivityLogPath` -FrontEndProtocolLogs | Enable to collect the protocol logging on the FE. Location: `(Get-FrontendTransportService $server).ReceiveProtocolLogPath` and `(Get-FrontendTransportService $server).SendProtocolLogPath` GetVDirs | Enable to collect the Virtual Directories of the environment. HighAvailabilityLogs | Enable to collect High Availability Logs. Windows Event Logs like: `Microsoft-Exchange-HighAvailability`, `Microsoft-Exchange-MailboxDatabaseFailureItems`, and `Microsoft-Windows-FailoverClustering` -HubConnectivityLogs | Enable to collect the Hub connectivity logging. Location: `(Get-TransportService $server).ConnectivityLogPath` -HubProtocolLogs | Enable to collect the protocol logging. Location: `(Get-TransportService $server).ReceiveProtocolLogPath` and `(Get-TransportService $server).SendProtocolLogPath` IISLogs | Enable to collect IIS Logs and HTTPErr Logs from the Exchange Server. Default Location: `C:\InetPub\logs\LogFiles\W3SVC1`, `C:\InetPub\logs\LogFiles\W3SVC2`, and `C:\Windows\System32\LogFiles\HTTPERR`. IISlogs do not collect all logs on CollectAllLogsBasedOnLogAge:$false, just works based on log age. ImapLogs | Enable to collect IMAP logging. Location: `(Get-ImapSettings -Server $server).LogFileLocation` MailboxAssistantsLogs | Enable to collect Mailbox Assistants logging. Location: `V15\Logging\MailboxAssistantsLog`, `V15\Logging\MailboxAssistantsSlaReportLog`, and `V15\Logging\MailboxAssistantsDatabaseSlaLog` -MailboxConnectivityLogs | Enable to collect the connectivity logging on the mailbox server. Location: `(Get-MailboxTransportService $server).ConnectivityLogPath` MailboxDeliveryThrottlingLogs | Enable to collect the mailbox delivery throttling logs on the server. Location: `(Get-MailboxTransportService $server).MailboxDeliveryThrottlingLogPath` -MailboxProtocolLogs | Enable to collect protocol logging on the mailbox server. Location: `(Get-MailboxTransportService $server).ReceiveProtocolLogPath` and `(Get-MailboxTransportService $server).SendProtocolLogPath` ManagedAvailabilityLogs | Enable to collect the Managed Availability Logs. Location: `V15\Logging\Monitoring` and Windows Event logs like `Microsoft-Exchange-ManagedAvailability` MapiLogs | Enable to collect MAPI Logs. Location: `V15\Logging\MAPI Client Access`, `V15\Logging\MapiHttp\Mailbox`, and `V15\Logging\HttpProxy\Mapi` MessageTrackingLogs | Enable to collect the Message Tracking Logs. Location: `(Get-TransportService $server).MessageTrackingLogPath` @@ -109,12 +103,13 @@ SendConnectors | Enable to collect the send connector information from the envir ServerInformation | Enable to collect general server information. TransportAgentLogs | Enable to collect the Agent Logs. Location: `(Get-TransportService $server).AgentLogPath`, `(Get-FrontendTransportService $server).AgentLogPath`, `(Get-MailboxTransportService $server).MailboxSubmissionAgentLogPath`, and `(Get-MailboxTransportService $server).MailboxDeliveryAgentLogPath` TransportConfig | Enable to collect the Transport Configuration files from the Server and `Get-TransportConfig` from the org. Files: `EdgeTransport.exe.config`, `MSExchangeFrontEndTransport.exe.config`, `MSExchangeDelivery.exe.config`, and `MSExchangeSubmission.exe.config` +TransportConnectivityLogs | Aliases `ConnectivityLogs`, `FrontEndConnectivityLogs`, `HubConnectivityLogs`, and `MailboxConnectivityLogs`. Enable to collect the logs that was set at the following locations: `(Get-FrontendTransportService $server).ConnectivityLogPath`, `(Get-TransportService $server).ConnectivityLogPath`, and `(Get-MailboxTransportService $server).ConnectivityLogPath` +TransportProtocolLogs | Aliases `ProtocolLogs`, `FrontEndProtocolLogs`, `HubProtocolLogs`, and `MailboxProtocolLogs`. Enable to collect the logs that was set at the following locations: `(Get-FrontendTransportService $server).ReceiveProtocolLogPath`, `(Get-FrontendTransportService $server).SendProtocolLogPath`, `(Get-TransportService $server).ReceiveProtocolLogPath`, `(Get-TransportService $server).SendProtocolLogPath`, `(Get-MailboxTransportService $server).ReceiveProtocolLogPath`, and `(Get-MailboxTransportService $server).SendProtocolLogPath` TransportRoutingTableLogs | Enable to collect the Routing Table Logs. Location: `(Get-TransportService $server).RoutingTableLogPath`, `(Get-FrontendTransportService $server).RoutingTableLogPath`, and `(Get-MailboxTransportService $server).RoutingTableLogPath` TransportRules | Enable to collect `Get-TransportRule`. WindowsSecurityLogs | Enable to collect the Windows Security Logs. Default Location: `'C:\Windows\System32\WinEvt\Logs\Security.evtx'` AllPossibleLogs | Enables the collection of all default logging collection on the Server. CollectAllLogsBasedOnLogAge | Boolean to determine if you collect all the logs based off the log's age or all the logs in that directory. Default value `$true` -ConnectivityLogs | Enables the following switches and their logs to be collected: `FrontEndConnectivityLogs`, `HubConnectivityLogs`, and `MailboxConnectivityLogs` DatabaseFailoverIssue | Enables the following switches and their logs to be collected. `DAGInformation`, `DailyPerformanceLogs`, `ExchangeServerInformation`, `ExPerfWiz`, `HighAvailabilityLogs`, `ManagedAvailabilityLogs`, and `ServerInformation`. DaysWorth | The number of days to go back to be included int the time span for log collection. Default value: 3 HoursWorth | The number of hours to go back to be included in the time span for the log collection. Default Value 0. @@ -127,6 +122,5 @@ LogAge | A Time Span value to use instead of the DaysWorth and HoursWorth parame OutlookConnectivityIssues | Enables the following switches and their logs to be collected: `AutoDLogs`, `DailyPerformanceLogs`, `EWSLogs`, `ExPerfWiz`, `IISLogs`, `MAPILogs`, `RPCLogs`, and `ServerInformation` PerformanceIssues | Enables the following switches and their logs to be collected: `DailyPerformanceLogs`, `ExPerfWiz`, and `ManagedAvailabilityLogs` PerformanceMailFlowIssues | Enables the following switches and their logs to be collected: `DailyPerformanceLogs`, `ExPerfWiz`, `MessageTrackingLogs`, `QueueInformation`, and `TransportConfig` -ProtocolLogs | Enables the following switches and their logs to be collected: `FrontEndProtocolLogs`, `HubProtocolLogs`, and `MailboxProtocolLogs` ScriptDebug | Enable to display all the verbose lines in the script. SkipEndCopyOver | If the Servers parameter is used, by default we will attempt to collect all the data back over to the local server after all the data was collected on each server. From 1f7b58e4c4f05b16d753da25899b361ba0dbadff Mon Sep 17 00:00:00 2001 From: David Paulson Date: Thu, 1 Aug 2024 13:51:55 -0500 Subject: [PATCH 2/3] DefaultTransportLogging to TransportLogging --- .../ExchangeLogCollector/ExchangeLogCollector.ps1 | 3 ++- .../Helpers/Get-ArgumentList.ps1 | 2 +- .../Helpers/Test-PossibleCommonScenarios.ps1 | 12 +++++------- docs/Diagnostics/ExchangeLogCollector.md | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Diagnostics/ExchangeLogCollector/ExchangeLogCollector.ps1 b/Diagnostics/ExchangeLogCollector/ExchangeLogCollector.ps1 index 71b6b27143..d1143cf622 100644 --- a/Diagnostics/ExchangeLogCollector/ExchangeLogCollector.ps1 +++ b/Diagnostics/ExchangeLogCollector/ExchangeLogCollector.ps1 @@ -16,7 +16,6 @@ param ( [switch]$CollectFailoverMetrics, [switch]$DAGInformation, [switch]$DailyPerformanceLogs, - [switch]$DefaultTransportLogging, [switch]$EASLogs, [switch]$ECPLogs, [switch]$EWSLogs, @@ -52,6 +51,8 @@ param ( [switch]$TransportConfig, [Alias("ConnectivityLogs", "FrontEndConnectivityLogs", "HubConnectivityLogs", "MailboxConnectivityLogs")] [switch]$TransportConnectivityLogs, + [Alias("DefaultTransportLogging")] + [switch]$TransportLogging, [Alias("ProtocolLogs", "FrontEndProtocolLogs", "HubProtocolLogs", "MailboxProtocolLogs")] [switch]$TransportProtocolLogs, [switch]$TransportRoutingTableLogs, diff --git a/Diagnostics/ExchangeLogCollector/Helpers/Get-ArgumentList.ps1 b/Diagnostics/ExchangeLogCollector/Helpers/Get-ArgumentList.ps1 index fc93bb7175..85dbfd021f 100644 --- a/Diagnostics/ExchangeLogCollector/Helpers/Get-ArgumentList.ps1 +++ b/Diagnostics/ExchangeLogCollector/Helpers/Get-ArgumentList.ps1 @@ -33,7 +33,7 @@ function Get-ArgumentList { CollectAllLogsBasedOnLogAge = $CollectAllLogsBasedOnLogAge DAGInformation = $DAGInformation DailyPerformanceLogs = $DailyPerformanceLogs - DefaultTransportLogging = $DefaultTransportLogging + TransportLogging = $TransportLogging EASLogs = $EASLogs ECPLogs = $ECPLogs EWSLogs = $EWSLogs diff --git a/Diagnostics/ExchangeLogCollector/Helpers/Test-PossibleCommonScenarios.ps1 b/Diagnostics/ExchangeLogCollector/Helpers/Test-PossibleCommonScenarios.ps1 index f79fa1c2ad..d656a9f16c 100644 --- a/Diagnostics/ExchangeLogCollector/Helpers/Test-PossibleCommonScenarios.ps1 +++ b/Diagnostics/ExchangeLogCollector/Helpers/Test-PossibleCommonScenarios.ps1 @@ -19,7 +19,7 @@ function Test-PossibleCommonScenarios { $Script:ServerInformation = $true $Script:GetVDirs = $true $Script:DAGInformation = $true - $Script:DefaultTransportLogging = $true + $Script:TransportLogging = $true $Script:MapiLogs = $true $Script:OrganizationConfig = $true $Script:ECPLogs = $true @@ -37,8 +37,9 @@ function Test-PossibleCommonScenarios { $Script:MailboxAssistantsLogs = $true } - if ($DefaultTransportLogging) { - $Script:HubConnectivityLogs = $true + if ($TransportLogging) { + $Script:TransportConnectivityLogs = $true + $Script:TransportProtocolLogs = $true $Script:MessageTrackingLogs = $true $Script:QueueInformation = $true $Script:SendConnectors = $true @@ -46,9 +47,6 @@ function Test-PossibleCommonScenarios { $Script:TransportAgentLogs = $true $Script:TransportConfig = $true $Script:TransportRoutingTableLogs = $true - $Script:FrontEndConnectivityLogs = $true - $Script:MailboxConnectivityLogs = $true - $Script:FrontEndProtocolLogs = $true $Script:MailboxDeliveryThrottlingLogs = $true $Script:PipelineTracingLogs = $true $Script:TransportRules = $true @@ -126,7 +124,7 @@ function Test-PossibleCommonScenarios { $MailboxDeliveryThrottlingLogs -or $TransportAgentLogs -or $TransportRoutingTableLogs -or - $DefaultTransportLogging -or + $TransportLogging -or $PipelineTracingLogs -or $TransportRules -or $AcceptedRemoteDomain) { diff --git a/docs/Diagnostics/ExchangeLogCollector.md b/docs/Diagnostics/ExchangeLogCollector.md index f0a18a24ac..2e4c8682d8 100644 --- a/docs/Diagnostics/ExchangeLogCollector.md +++ b/docs/Diagnostics/ExchangeLogCollector.md @@ -72,7 +72,6 @@ AutoDLogs | Enable to collect AutoDiscover Logs. Location: `V15\Logging\Autodisc CollectFailoverMetrics | Enable to run the `CollectOverMetrics.ps1` script against the DAG. Only able to be run on an Exchange tools box or an Exchange Server. DAGInformation | Enable to collect the DAG Information from all different DAGs that are in the list of servers. DailyPerformanceLogs | Enable to collect Daily Performance Logs. Default Location: `V15\Logging\Diagnostics\DailyPerformanceLogs` -DefaultTransportLogging | Enables the following switches and their logs to be collected. `AcceptedRemoteDomain`, `FrontEndConnectivityLogs`, `FrontEndProtocolLogs`, `HubConnectivityLogs`, `MailboxConnectivityLogs`, `MailboxDeliveryThrottlingLogs`, `MessageTrackingLogs`, `PipelineTracingLogs`, `QueueInformation`, `ReceiveConnectors`, `SendConnectors`, `TransportConfig`, `TransportRoutingTableLogs`, and `TransportRules` EASLogs | Enable to collect Exchange Active Sync Logging. Location: `V15\Logging\HttpProxy\Eas` ECPLogs | Enable to collect ECP Logs. Location: `V15\Logging\ECP` and `V15\Logging\HttpProxy\Ecp` EWSLogs | Enable to collect EWS Logs. Location: `V15\Logging\HttpProxy\Ews` and `V15\Logging\Ews` @@ -104,6 +103,7 @@ ServerInformation | Enable to collect general server information. TransportAgentLogs | Enable to collect the Agent Logs. Location: `(Get-TransportService $server).AgentLogPath`, `(Get-FrontendTransportService $server).AgentLogPath`, `(Get-MailboxTransportService $server).MailboxSubmissionAgentLogPath`, and `(Get-MailboxTransportService $server).MailboxDeliveryAgentLogPath` TransportConfig | Enable to collect the Transport Configuration files from the Server and `Get-TransportConfig` from the org. Files: `EdgeTransport.exe.config`, `MSExchangeFrontEndTransport.exe.config`, `MSExchangeDelivery.exe.config`, and `MSExchangeSubmission.exe.config` TransportConnectivityLogs | Aliases `ConnectivityLogs`, `FrontEndConnectivityLogs`, `HubConnectivityLogs`, and `MailboxConnectivityLogs`. Enable to collect the logs that was set at the following locations: `(Get-FrontendTransportService $server).ConnectivityLogPath`, `(Get-TransportService $server).ConnectivityLogPath`, and `(Get-MailboxTransportService $server).ConnectivityLogPath` +TransportLogging | Enables the following switches and their logs to be collected. `AcceptedRemoteDomain`, `TransportConnectivityLogs`, `TransportProtocolLogs`, `MailboxDeliveryThrottlingLogs`, `MessageTrackingLogs`, `PipelineTracingLogs`, `QueueInformation`, `ReceiveConnectors`, `SendConnectors`, `TransportConfig`, `TransportRoutingTableLogs`, and `TransportRules` TransportProtocolLogs | Aliases `ProtocolLogs`, `FrontEndProtocolLogs`, `HubProtocolLogs`, and `MailboxProtocolLogs`. Enable to collect the logs that was set at the following locations: `(Get-FrontendTransportService $server).ReceiveProtocolLogPath`, `(Get-FrontendTransportService $server).SendProtocolLogPath`, `(Get-TransportService $server).ReceiveProtocolLogPath`, `(Get-TransportService $server).SendProtocolLogPath`, `(Get-MailboxTransportService $server).ReceiveProtocolLogPath`, and `(Get-MailboxTransportService $server).SendProtocolLogPath` TransportRoutingTableLogs | Enable to collect the Routing Table Logs. Location: `(Get-TransportService $server).RoutingTableLogPath`, `(Get-FrontendTransportService $server).RoutingTableLogPath`, and `(Get-MailboxTransportService $server).RoutingTableLogPath` TransportRules | Enable to collect `Get-TransportRule`. From e9542a90f17e7e1fb13d29e924e650c040b1536f Mon Sep 17 00:00:00 2001 From: David Paulson Date: Thu, 1 Aug 2024 14:18:49 -0500 Subject: [PATCH 3/3] Add logging for passed arguments --- .../Helpers/Get-ArgumentList.ps1 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Diagnostics/ExchangeLogCollector/Helpers/Get-ArgumentList.ps1 b/Diagnostics/ExchangeLogCollector/Helpers/Get-ArgumentList.ps1 index 85dbfd021f..72bd9d454f 100644 --- a/Diagnostics/ExchangeLogCollector/Helpers/Get-ArgumentList.ps1 +++ b/Diagnostics/ExchangeLogCollector/Helpers/Get-ArgumentList.ps1 @@ -23,7 +23,7 @@ function Get-ArgumentList { $Script:MasterServer = $Servers[0] } - return [PSCustomObject]@{ + $argumentList = [PSCustomObject]@{ AcceptedRemoteDomain = $AcceptedRemoteDomain ADDriverLogs = $ADDriverLogs AnyTransportSwitchesEnabled = $Script:AnyTransportSwitchesEnabled @@ -83,4 +83,21 @@ function Get-ArgumentList { TransportRules = $TransportRules WindowsSecurityLogs = $WindowsSecurityLogs } + + Write-Verbose "Passed arguments" + $argumentList | Format-List | Out-String | Write-Verbose + Write-Verbose "Server Object Results" + $argumentList.ServerObjects | ForEach-Object { + $currentServer = $_ + $currentServer | Format-List | Out-String | Write-Verbose + if ($Script:AnyTransportSwitchesEnabled) { + $currentServer.TransportInfo.FELoggingInfo | Format-List | Out-String | Write-Verbose + $currentServer.TransportInfo.HubLoggingInfo | Format-List | Out-String | Write-Verbose + $currentServer.TransportInfo.MbxLoggingInfo | Format-List | Out-String | Write-Verbose + } + + Write-Verbose "End Server Object Results for $($currentServer.ServerName)" + } + + return $argumentList }