Skip to content

Commit

Permalink
Merge pull request #2246 from microsoft/dpaul-HcMemory
Browse files Browse the repository at this point in the history
Address math rounding issue for dynamic memory detection
  • Loading branch information
dpaulson45 authored Dec 6, 2024
2 parents 5058ec6 + 02aa66e commit 9deeb1e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ function Invoke-AnalyzerHardwareInformation {
}

$totalPhysicalMemory = [System.Math]::Round($hardwareInformation.TotalMemory / 1024 / 1024 / 1024)
$totalPhysicalMemoryNotRounded = $hardwareInformation.TotalMemory / 1GB
$displayWriteType = "Yellow"
$displayDetails = [string]::Empty

Expand Down Expand Up @@ -310,7 +311,8 @@ function Invoke-AnalyzerHardwareInformation {
if ($null -eq $counter) {
$params.Details = "Unknown - Required Counter Not Loaded"
$params.DisplayWriteType = "Yellow"
} elseif (($counter.CookedValue / 1024) -ne $totalPhysicalMemory) {
} elseif (($counter.CookedValue / 1024) -ne $totalPhysicalMemory -and
($counter.CookedValue / 1024) -ne $totalPhysicalMemoryNotRounded) {
$params.Details = "$true $($counter.CookedValue / 1024)GB is the allowed dynamic memory of the server. Not supported to have dynamic memory configured."
$params.DisplayWriteType = "Red"
}
Expand Down

0 comments on commit 9deeb1e

Please sign in to comment.