Skip to content

Commit

Permalink
Merge pull request #2163 from microsoft/dpaul-ElcDev
Browse files Browse the repository at this point in the history
Exchange Log Collector Update - Parameter selection Update and logging for passed arguments
  • Loading branch information
dpaulson45 authored Aug 6, 2024
2 parents df1ed64 + e9542a9 commit cb21ece
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 32 deletions.
15 changes: 6 additions & 9 deletions Diagnostics/ExchangeLogCollector/ExchangeLogCollector.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,19 @@ param (
[switch]$CollectFailoverMetrics,
[switch]$DAGInformation,
[switch]$DailyPerformanceLogs,
[switch]$DefaultTransportLogging,
[switch]$EASLogs,
[switch]$ECPLogs,
[switch]$EWSLogs,
[Alias("ExchangeServerInfo")]
[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,
Expand All @@ -56,13 +49,18 @@ param (
[switch]$ServerInformation,
[switch]$TransportAgentLogs,
[switch]$TransportConfig,
[Alias("ConnectivityLogs", "FrontEndConnectivityLogs", "HubConnectivityLogs", "MailboxConnectivityLogs")]
[switch]$TransportConnectivityLogs,
[Alias("DefaultTransportLogging")]
[switch]$TransportLogging,
[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,
Expand All @@ -80,7 +78,6 @@ param (
[switch]$OutlookConnectivityIssues,
[switch]$PerformanceIssues,
[switch]$PerformanceMailFlowIssues,
[switch]$ProtocolLogs,
[switch]$ScriptDebug,
[bool]$SkipEndCopyOver
)
Expand Down
21 changes: 19 additions & 2 deletions Diagnostics/ExchangeLogCollector/Helpers/Get-ArgumentList.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function Get-ArgumentList {
$Script:MasterServer = $Servers[0]
}

return [PSCustomObject]@{
$argumentList = [PSCustomObject]@{
AcceptedRemoteDomain = $AcceptedRemoteDomain
ADDriverLogs = $ADDriverLogs
AnyTransportSwitchesEnabled = $Script:AnyTransportSwitchesEnabled
Expand All @@ -33,7 +33,7 @@ function Get-ArgumentList {
CollectAllLogsBasedOnLogAge = $CollectAllLogsBasedOnLogAge
DAGInformation = $DAGInformation
DailyPerformanceLogs = $DailyPerformanceLogs
DefaultTransportLogging = $DefaultTransportLogging
TransportLogging = $TransportLogging
EASLogs = $EASLogs
ECPLogs = $ECPLogs
EWSLogs = $EWSLogs
Expand Down Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,37 +31,35 @@ 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
}

if ($DefaultTransportLogging) {
$Script:HubConnectivityLogs = $true
if ($TransportLogging) {
$Script:TransportConnectivityLogs = $true
$Script:TransportProtocolLogs = $true
$Script:MessageTrackingLogs = $true
$Script:QueueInformation = $true
$Script:SendConnectors = $true
$Script:ReceiveConnectors = $true
$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
$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
Expand Down Expand Up @@ -126,7 +124,7 @@ function Test-PossibleCommonScenarios {
$MailboxDeliveryThrottlingLogs -or
$TransportAgentLogs -or
$TransportRoutingTableLogs -or
$DefaultTransportLogging -or
$TransportLogging -or
$PipelineTracingLogs -or
$TransportRules -or
$AcceptedRemoteDomain) {
Expand Down
14 changes: 4 additions & 10 deletions docs/Diagnostics/ExchangeLogCollector.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -72,25 +72,18 @@ 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`
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`
Expand All @@ -109,12 +102,14 @@ 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`
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`.
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.
Expand All @@ -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.

0 comments on commit cb21ece

Please sign in to comment.