Skip to content

Commit

Permalink
Merge pull request #2167 from microsoft/dpaul-HcUnifiedContent
Browse files Browse the repository at this point in the history
Unified Content Auto Cleanup Check Added
  • Loading branch information
dpaulson45 authored Aug 8, 2024
2 parents 0569068 + 15a60a3 commit 142acec
Show file tree
Hide file tree
Showing 13 changed files with 3,534 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,4 +348,48 @@ function Invoke-AnalyzerFrequentConfigurationIssues {
}
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
$cleanupFolderResponderFolderPaths = (([xml]$exchangeInformation.FileContentInformation[$antiMalwareKey].Content).Definition.MaintenanceDefinition.ExtensionAttributes.CleanupFolderResponderFolderPaths)
$cleanupPathsExists = $cleanupFolderResponderFolderPaths -like "*$temporaryStoragePath\UnifiedContent*"

if ($cleanupPathsExists) {
$params.DisplayWriteType = "Green"
}

$params.Details = $cleanupPathsExists
Add-AnalyzedResultInformation @params

if ($cleanupPathsExists -eq $false) {
$params = $baseParams + @{
Details = "More Information: https://aka.ms/HC-UnifiedContentCleanup"
DisplayWriteType = "Yellow"
DisplayCustomTabNumber = 2
}
Add-AnalyzedResultInformation @params
}
} catch {
if ($edgeKeySuccessful) {
$params.Details = "AntiMalware.xml Invalid Config Format"
} else {
$params.Details = "Error - EdgeTransport.exe.config Invalid Config Format"
}
Add-AnalyzedResultInformation @params
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ function Get-ExchangeInformation {
$configParams = @{
ComputerName = $Server
FileLocation = @("$([System.IO.Path]::Combine($serverExchangeBinDirectory, "EdgeTransport.exe.config"))",
"$([System.IO.Path]::Combine($serverExchangeBinDirectory, "Search\Ceres\Runtime\1.0\noderunner.exe.config"))")
"$([System.IO.Path]::Combine($serverExchangeBinDirectory, "Search\Ceres\Runtime\1.0\noderunner.exe.config"))",
"$([System.IO.Path]::Combine($serverExchangeBinDirectory, "Monitoring\Config\AntiMalware.xml"))")
}

if ($getExchangeServer.IsEdgeServer -eq $false -and
Expand Down Expand Up @@ -203,7 +204,7 @@ function Get-ExchangeInformation {
CatchActionFunction = ${Function:Invoke-CatchActions}
ScriptBlock = {
[PSCustomObject]@{
LocalGroupMember = (Get-LocalGroupMember -SID "S-1-5-32-544" -ErrorAction Stop)
LocalGroupMember = (Get-LocalGroupMember -SID "S-1-5-32-544" -ErrorAction Stop)
ADGroupMembership = (Get-ADPrincipalGroupMembership (Get-ADComputer $env:COMPUTERNAME).DistinguishedName)
}
}
Expand Down
Loading

0 comments on commit 142acec

Please sign in to comment.