From c88c5acfea8ebd396188356bd8ffaf941cda35de Mon Sep 17 00:00:00 2001 From: Dmitry Khrebin Date: Fri, 28 Aug 2026 14:53:06 +0100 Subject: [PATCH 1/2] Test-ExchAVExclusions: add the server name to the output files I want to see the server name in the results. Engineers often share only one of the output files, and when the data comes from several servers there is nothing in the file that says which server it belongs to. Stamp the computer name into the BadExclusions and Results/Debug file names and into the header line written inside them. --- Diagnostics/AVTester/Test-ExchAVExclusions.ps1 | 12 ++++++------ docs/Diagnostics/Test-ExchAVExclusions.md | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Diagnostics/AVTester/Test-ExchAVExclusions.ps1 b/Diagnostics/AVTester/Test-ExchAVExclusions.ps1 index 85002b0f01..978bdbae3f 100644 --- a/Diagnostics/AVTester/Test-ExchAVExclusions.ps1 +++ b/Diagnostics/AVTester/Test-ExchAVExclusions.ps1 @@ -46,10 +46,10 @@ Just update script version to latest one. .OUTPUTS Log file: -$PSScriptRoot\Test-ExchAvExclusions-#DataTime#.txt +$PSScriptRoot\Test-ExchAvExclusions-#ServerName#-#DataTime#.txt List of Scanned Folders: -$PSScriptRoot\BadExclusions-#DataTime#.txt +$PSScriptRoot\BadExclusions-#ServerName#-#DataTime#.txt .EXAMPLE .\Test-ExchAVExclusions.ps1 @@ -101,7 +101,7 @@ function Write-HostLog ($message) { } } -$LogFileName = "Test-ExchAvExclusions" +$LogFileName = "Test-ExchAvExclusions-$env:COMPUTERNAME" $StartDate = Get-Date $StartDateFormatted = ($StartDate).ToString("yyyyMMddhhmmss") $Script:DebugLogger = Get-NewLoggerInstance -LogName "$LogFileName-Debug-$StartDateFormatted" -LogDirectory $PSScriptRoot -AppendDateTimeToFileName $false -ErrorAction SilentlyContinue @@ -114,7 +114,7 @@ SetWriteWarningAction ${Function:Write-HostLog} $BuildVersion = "" -Write-Host ("Test-ExchAVExclusions.ps1 script version $($BuildVersion)") -ForegroundColor Green +Write-Host ("Test-ExchAVExclusions.ps1 script version $($BuildVersion) on server $env:COMPUTERNAME") -ForegroundColor Green if ($ScriptUpdateOnly) { switch (Test-ScriptVersion -AutoUpdate -VersionsUrl "https://aka.ms/Test-ExchAVExclusions-VersionsURL" -Confirm:$false) { @@ -605,9 +605,9 @@ foreach ($extension in $extensionsList) { #Delete Random Folder Remove-Item $randomFolder -Confirm:$false -Force -Recurse -$OutputPath = Join-Path $PSScriptRoot BadExclusions-$StartDateFormatted.txt +$OutputPath = Join-Path $PSScriptRoot "BadExclusions-$env:COMPUTERNAME-$StartDateFormatted.txt" "###########################################################################################" | Out-File $OutputPath -"Exclusions analysis at $((Get-Date).ToString())" | Out-File $OutputPath -Append +"Exclusions analysis on server $env:COMPUTERNAME at $((Get-Date).ToString())" | Out-File $OutputPath -Append "###########################################################################################" | Out-File $OutputPath -Append # Report what we found diff --git a/docs/Diagnostics/Test-ExchAVExclusions.md b/docs/Diagnostics/Test-ExchAVExclusions.md index b1ab97d1c5..d7cb210dda 100644 --- a/docs/Diagnostics/Test-ExchAVExclusions.md +++ b/docs/Diagnostics/Test-ExchAVExclusions.md @@ -61,7 +61,7 @@ ScriptUpdateOnly | Just update script version to latest one. ## Outputs Log file: -$PSScriptRoot\Test-ExchAvExclusions-#DateTime#.txt +$PSScriptRoot\Test-ExchAvExclusions-#ServerName#-#DateTime#.txt List of Folders, extensions Scanned by AV and List of Non-Default Processes: -$PSScriptRoot\BadExclusions-#DateTime#.txt +$PSScriptRoot\BadExclusions-#ServerName#-#DateTime#.txt From 98fbf4bf5602abf432db05508a1f9c74f23f7c21 Mon Sep 17 00:00:00 2001 From: Dmitry Khrebin Date: Fri, 11 Sep 2026 11:53:59 +0100 Subject: [PATCH 2/2] Test-ExchAVExclusions: document both log files in OUTPUTS Addresses the review feedback. The OUTPUTS block described a single log file, but the script writes two, a Results log and a Debug log. Also corrects the #DataTime# placeholder to #DateTime#, which is what the rest of the documentation uses. --- Diagnostics/AVTester/Test-ExchAVExclusions.ps1 | 7 ++++--- docs/Diagnostics/Test-ExchAVExclusions.md | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Diagnostics/AVTester/Test-ExchAVExclusions.ps1 b/Diagnostics/AVTester/Test-ExchAVExclusions.ps1 index 978bdbae3f..6af6a1e131 100644 --- a/Diagnostics/AVTester/Test-ExchAVExclusions.ps1 +++ b/Diagnostics/AVTester/Test-ExchAVExclusions.ps1 @@ -45,11 +45,12 @@ Skip script version verification. Just update script version to latest one. .OUTPUTS -Log file: -$PSScriptRoot\Test-ExchAvExclusions-#ServerName#-#DataTime#.txt +Log files: +$PSScriptRoot\Test-ExchAvExclusions-#ServerName#-Results-#DateTime#.txt +$PSScriptRoot\Test-ExchAvExclusions-#ServerName#-Debug-#DateTime#.txt List of Scanned Folders: -$PSScriptRoot\BadExclusions-#ServerName#-#DataTime#.txt +$PSScriptRoot\BadExclusions-#ServerName#-#DateTime#.txt .EXAMPLE .\Test-ExchAVExclusions.ps1 diff --git a/docs/Diagnostics/Test-ExchAVExclusions.md b/docs/Diagnostics/Test-ExchAVExclusions.md index d7cb210dda..76e4b0e502 100644 --- a/docs/Diagnostics/Test-ExchAVExclusions.md +++ b/docs/Diagnostics/Test-ExchAVExclusions.md @@ -60,8 +60,9 @@ ScriptUpdateOnly | Just update script version to latest one. ## Outputs -Log file: -$PSScriptRoot\Test-ExchAvExclusions-#ServerName#-#DateTime#.txt +Log files: +$PSScriptRoot\Test-ExchAvExclusions-#ServerName#-Results-#DateTime#.txt +$PSScriptRoot\Test-ExchAvExclusions-#ServerName#-Debug-#DateTime#.txt List of Folders, extensions Scanned by AV and List of Non-Default Processes: $PSScriptRoot\BadExclusions-#ServerName#-#DateTime#.txt