Skip to content

Commit 4284df0

Browse files
dpaulson45Copilot
andcommitted
Health Checker: Improve error message for orphaned SIDs in local Administrators group
When Get-LocalGroupMember fails due to orphaned SIDs in the built-in Administrators group (InvalidOperationException on Server 2019/2022), display a helpful message indicating orphaned SIDs may be the cause instead of the misleading 'results were blank' message. Server 2025 handles orphaned SIDs natively so this check is only applied on older OS versions (build < 10.0.26100). Fixes #2381 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 611c077 commit 4284df0

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

Diagnostics/HealthChecker/Analyzer/Invoke-AnalyzerExchangeInformation.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,13 @@ function Invoke-AnalyzerExchangeInformation {
335335
}
336336
}
337337
} else {
338-
$displayMissingGroups.Add("Unable to determine Local System Membership as the results were blank.")
338+
if ($null -ne $exchangeInformation.ADComputerObject.LocalGroupMemberException -and
339+
$exchangeInformation.ADComputerObject.LocalGroupMemberException.Exception -is [System.InvalidOperationException] -and
340+
$HealthServerObject.OSInformation.BuildInformation.BuildVersion -lt [System.Version]"10.0.26100") {
341+
$displayMissingGroups.Add("Unable to determine Local System Membership. This can occur when orphaned SIDs exist in the local Administrators group.")
342+
} else {
343+
$displayMissingGroups.Add("Unable to determine Local System Membership as the results were blank.")
344+
}
339345
}
340346

341347
if ($null -ne $exchangeInformation.ADComputerObject.ADGroupMembership -and

Diagnostics/HealthChecker/DataCollection/ExchangeInformation/Invoke-JobExchangeInformationLocal.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ function Invoke-JobExchangeInformationLocal {
124124
$localGroupMember = Get-LocalGroupMember -SID "S-1-5-32-544" -ErrorAction Stop
125125
} catch {
126126
Write-Verbose "Failed to run Get-LocalGroupMember. Inner Exception: $_"
127+
$localGroupMemberException = $_
127128
Invoke-CatchActions
128129
}
129130
}
@@ -210,6 +211,7 @@ function Invoke-JobExchangeInformationLocal {
210211
IanaTimeZoneMappingsRaw = $ianaTimeZoneMappingContent
211212
FileContentInformation = $fileContentInformation
212213
LocalGroupMember = $localGroupMember
214+
LocalGroupMemberException = $localGroupMemberException
213215
RemoteJob = $true -eq $PSSenderInfo
214216
JobHandledErrors = $jobHandledErrors
215217
AllErrors = $Error

Diagnostics/HealthChecker/Features/Get-HealthCheckerDataObject.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ function Get-HealthCheckerDataObject {
127127
VirtualDirectories = $ExchangeCmdletResult.VirtualDirectories
128128
ExchangeCertificateInformation = $exchangeCertificateInformation
129129
ADComputerObject = [PSCustomObject]@{
130-
ADObject = $ExchangeCmdletResult.ADObject.ComputerObject
131-
ADGroupMembership = $ExchangeCmdletResult.ADObject.GroupMembership
132-
LocalGroupMember = $ExchangeLocalResult.LocalGroupMember
130+
ADObject = $ExchangeCmdletResult.ADObject.ComputerObject
131+
ADGroupMembership = $ExchangeCmdletResult.ADObject.GroupMembership
132+
LocalGroupMember = $ExchangeLocalResult.LocalGroupMember
133+
LocalGroupMemberException = $ExchangeLocalResult.LocalGroupMemberException
133134
}
134135
AES256CBCInformation = $ExchangeLocalResult.AES256CBCInformation
135136
ApplicationConfigFileStatus = $ExchangeLocalResult.ApplicationConfigFileStatus

0 commit comments

Comments
 (0)