Repository: microsoft/CSS-Exchange
File: Diagnostics/HealthChecker/Analyzer/Invoke-AnalyzerFrequentConfigurationIssues.ps1 (PowerShell)

Code before:
            }
            Add-AnalyzedResultInformation @params
            $showMoreInfo = $true
        }
    }

    if ($showMoreInfo) {
        $params = $baseParams + @{
            Details                = "More Information: https://aka.ms/HC-ExoConnectorIssue"
            DisplayWriteType       = "Yellow"
            DisplayCustomTabNumber = 2
        }
        Add-AnalyzedResultInformation @params
    }

    if ($null -ne $exchangeInformation.TransportService) {
        if ($exchangeInformation.TransportService.MaxPerDomainOutboundConnections -lt 40) {
            $params = $baseParams + @{
                Name             = "MaxPerDomainOutboundConnections"
                Details          = "Value set to $($exchangeInformation.TransportService.MaxPerDomainOutboundConnections), which is less than the recommended value of 40. `r`n`t`tMore details: https://aka.ms/TransportRetryConfig"
                DisplayWriteType = "Yellow"
            }
            Add-AnalyzedResultInformation @params
        }

        if ($exchangeInformation.TransportService.MessageRetryInterval -gt [System.TimeSpan]::FromMinutes(5)) {
            $params = $baseParams + @{
                Name             = "MessageRetryInterval"
                Details          = "Value set to $($exchangeInformation.TransportService.MessageRetryInterval), which is greater than the recommended value of 5 minutes. `r`n`t`tMore details: https://aka.ms/TransportRetryConfig"
                DisplayWriteType = "Yellow"
            }
            Add-AnalyzedResultInformation @params
        }
    }

    $edgeKey = $exchangeInformation.ApplicationConfigFileStatus.Keys | Where-Object { $_ -like "*\EdgeTransport.exe.config" }
    $antiMalwareKey = $exchangeInformation.FileContentInformation.Keys | Where-Object { $_ -like "*\Monitoring\Config\AntiMalware.xml" }

    if ($null -ne $edgeKey -and
        $null -ne $antiMalwareKey -and
        $exchangeInformation.ApplicationConfigFileStatus[$edgeKey].Present -and
        $exchangeInformation.FileContentInformation[$antiMalwareKey].Present) {
        $params = $baseParams + @{
            Name             = "UnifiedContent Auto Cleanup Configured"
            Details          = "Unknown"
            DisplayWriteType = "Red"
        }
        try {
            $temporaryStoragePath = (([xml]$exchangeInformation.ApplicationConfigFileStatus[$edgeKey].Content).configuration.appSettings.add |
                    Where-Object { $_.key -eq "TemporaryStoragePath" }).value
            $edgeKeySuccessful = $true

Review comment (suggestion):
I don't believe this is going to work with Remote PowerShell, as we don't normally have data types there. Please verify this.

Code after:
            }
            Add-AnalyzedResultInformation @params
            $showMoreInfo = $true
        }
    }

    if ($showMoreInfo) {
        $params = $baseParams + @{
            Details                = "More Information: https://aka.ms/HC-ExoConnectorIssue"
            DisplayWriteType       = "Yellow"
            DisplayCustomTabNumber = 2
        }
        Add-AnalyzedResultInformation @params
    }

    if ($null -ne $exchangeInformation.GetTransportService) {
        if ($exchangeInformation.GetTransportService.MaxPerDomainOutboundConnections -lt 40) {
            $params = $baseParams + @{
                Name             = "MaxPerDomainOutboundConnections"
                Details          = "Value set to $($exchangeInformation.GetTransportService.MaxPerDomainOutboundConnections), which is less than the recommended value of 40. `r`n`t`tMore details: https://aka.ms/HC-TransportRetryConfigCheck"
                DisplayWriteType = "Yellow"
            }
            Add-AnalyzedResultInformation @params
        }

        if ($exchangeInformation.GetTransportService.MessageRetryInterval -gt [System.TimeSpan]::FromMinutes(5)) {
            $params = $baseParams + @{
                Name             = "MessageRetryInterval"
                Details          = "Value set to $($exchangeInformation.GetTransportService.MessageRetryInterval), which is greater than the recommended value of 5 minutes. `r`n`t`tMore details: https://aka.ms/HC-TransportRetryConfigCheck"
                DisplayWriteType = "Yellow"
            }
            Add-AnalyzedResultInformation @params
        }
    }

    $edgeKey = $exchangeInformation.ApplicationConfigFileStatus.Keys | Where-Object { $_ -like "*\EdgeTransport.exe.config" }
    $antiMalwareKey = $exchangeInformation.FileContentInformation.Keys | Where-Object { $_ -like "*\Monitoring\Config\AntiMalware.xml" }

    if ($null -ne $edgeKey -and
        $null -ne $antiMalwareKey -and
        $exchangeInformation.ApplicationConfigFileStatus[$edgeKey].Present -and
        $exchangeInformation.FileContentInformation[$antiMalwareKey].Present) {
        $params = $baseParams + @{
            Name             = "UnifiedContent Auto Cleanup Configured"
            Details          = "Unknown"
            DisplayWriteType = "Red"
        }
        try {
            $temporaryStoragePath = (([xml]$exchangeInformation.ApplicationConfigFileStatus[$edgeKey].Content).configuration.appSettings.add |
                    Where-Object { $_.key -eq "TemporaryStoragePath" }).value
            $edgeKeySuccessful = $true