diff --git a/Diagnostics/HealthChecker/Analyzer/Invoke-AnalyzerHardwareInformation.ps1 b/Diagnostics/HealthChecker/Analyzer/Invoke-AnalyzerHardwareInformation.ps1 index 64b508fc6b..ece68db6d8 100644 --- a/Diagnostics/HealthChecker/Analyzer/Invoke-AnalyzerHardwareInformation.ps1 +++ b/Diagnostics/HealthChecker/Analyzer/Invoke-AnalyzerHardwareInformation.ps1 @@ -69,21 +69,32 @@ Function Invoke-AnalyzerHardwareInformation { $physicalValue = $hardwareInformation.Processor.NumberOfPhysicalCores $logicalValue = $hardwareInformation.Processor.NumberOfLogicalCores - $displayWriteType = "Green" + $physicalValueDisplay = $physicalValue + $logicalValueDisplay = $logicalValue + $displayWriteTypeLogic = $displayWriteTypePhysical = "Green" if (($logicalValue -gt 24 -and $exchangeInformation.BuildInformation.MajorVersion -lt [HealthChecker.ExchangeMajorVersion]::Exchange2019) -or $logicalValue -gt 48) { - $displayWriteType = "Yellow" + $displayWriteTypeLogic = "Red" + + if (($physicalValue -gt 24 -and + $exchangeInformation.BuildInformation.MajorVersion -lt [HealthChecker.ExchangeMajorVersion]::Exchange2019) -or + $physicalValue -gt 48) { + $physicalValueDisplay = "$physicalValue - Error" + $displayWriteTypePhysical = "Red" + } + + $logicalValueDisplay = "$logicalValue - Error" } - $AnalyzeResults | Add-AnalyzedResultInformation -Name "Number of Physical Cores" -Details $physicalValue ` + $AnalyzeResults | Add-AnalyzedResultInformation -Name "Number of Physical Cores" -Details $physicalValueDisplay ` -DisplayGroupingKey $keyHardwareInformation ` - -DisplayWriteType $displayWriteType + -DisplayWriteType $displayWriteTypePhysical - $AnalyzeResults | Add-AnalyzedResultInformation -Name "Number of Logical Cores" -Details $logicalValue ` + $AnalyzeResults | Add-AnalyzedResultInformation -Name "Number of Logical Cores" -Details $logicalValueDisplay ` -DisplayGroupingKey $keyHardwareInformation ` - -DisplayWriteType $displayWriteType ` + -DisplayWriteType $displayWriteTypeLogic ` -AddHtmlOverviewValues $true $displayValue = "Disabled" diff --git a/Diagnostics/HealthChecker/Tests/DataCollection/E16/Hardware/HyperV_Win32_Processor1.xml b/Diagnostics/HealthChecker/Tests/DataCollection/E16/Hardware/HyperV_Win32_Processor1.xml new file mode 100644 index 0000000000..3b0e6e6ec9 --- /dev/null +++ b/Diagnostics/HealthChecker/Tests/DataCollection/E16/Hardware/HyperV_Win32_Processor1.xml @@ -0,0 +1,106 @@ + + + + System.Management.ManagementObject#root\cimv2\Win32_Processor + System.Management.ManagementObject#root\cimv2\CIM_Processor + System.Management.ManagementObject#root\cimv2\CIM_LogicalDevice + System.Management.ManagementObject#root\cimv2\CIM_LogicalElement + System.Management.ManagementObject#root\cimv2\CIM_ManagedSystemElement + System.Management.ManagementObject#Win32_Processor + System.Management.ManagementObject#CIM_Processor + System.Management.ManagementObject#CIM_LogicalDevice + System.Management.ManagementObject#CIM_LogicalElement + System.Management.ManagementObject#CIM_ManagedSystemElement + System.Management.ManagementObject + System.Management.ManagementBaseObject + System.ComponentModel.Component + System.MarshalByRefObject + System.Object + + \\SOLO-E16A\root\cimv2:Win32_Processor.DeviceID="CPU0" + + 2 + Win32_Processor + CIM_Processor + CIM_ManagedSystemElement + Win32_Processor.DeviceID="CPU0" + 57 + + + System.String[] + System.Array + System.Object + + + CIM_Processor + CIM_LogicalDevice + CIM_LogicalElement + CIM_ManagedSystemElement + + + SOLO-E16A + root\cimv2 + \\SOLO-E16A\root\cimv2:Win32_Processor.DeviceID="CPU0" + 64 + 9 + None + 3 + Intel64 Family 6 Model 45 Stepping 7 + 4 + + + 1 + Win32_Processor + 2200 + 10 + 64 + Intel64 Family 6 Model 45 Stepping 7 + CPU0 + + + 100 + 179 + + + + 0 + 0 + + 6 + 1 + GenuineIntel + 2200 + Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz + 48 + 48 + 48 + + None + + + false + 0000000000000000 + 3 + 11527 + CPU + false + None + None + OK + 3 + + Win32_ComputerSystem + SOLO-E16A + 1 + + 6 + + false + false + + + + SOLO-E16A + + + \ No newline at end of file diff --git a/Diagnostics/HealthChecker/Tests/HealthChecker.E16.Tests.ps1 b/Diagnostics/HealthChecker/Tests/HealthChecker.E16.Tests.ps1 index a2f3d288af..f0fe2617e5 100644 --- a/Diagnostics/HealthChecker/Tests/HealthChecker.E16.Tests.ps1 +++ b/Diagnostics/HealthChecker/Tests/HealthChecker.E16.Tests.ps1 @@ -131,4 +131,21 @@ Describe "Testing Health Checker by Mock Data Imports - Exchange 2016" { $Script:ActiveGrouping.Count | Should -Be 11 } } + + Context "Testing Scenario 1 - Exchange 2016" { + BeforeAll { + Mock Invoke-ScriptBlockHandler -ParameterFilter { $ScriptBlockDescription -eq "Test EEMS pattern service connectivity" } -MockWith { return $null } + Mock Get-WmiObjectHandler -ParameterFilter { $Class -eq "Win32_Processor" } ` + -MockWith { return Import-Clixml "$Script:MockDataCollectionRoot\Hardware\HyperV_Win32_Processor1.xml" } + $hc = Get-HealthCheckerExchangeServer + $hc | Export-Clixml $PSScriptRoot\Debug_E16_Results.xml -Depth 6 -Encoding utf8 + $Script:results = Invoke-AnalyzerEngine $hc + } + + It "Display Results - Process/Hardware Information" { + SetActiveDisplayGrouping "Processor/Hardware Information" + TestObjectMatch "Number of Physical Cores" "48 - Error" -WriteType "Red" + TestObjectMatch "Number of Logical Cores" "48 - Error" -WriteType "Red" + } + } } diff --git a/Diagnostics/HealthChecker/Tests/HealthChecker.Tests.ps1 b/Diagnostics/HealthChecker/Tests/HealthChecker.Tests.ps1 index 17e7038f8f..fb4ed2d6f0 100644 --- a/Diagnostics/HealthChecker/Tests/HealthChecker.Tests.ps1 +++ b/Diagnostics/HealthChecker/Tests/HealthChecker.Tests.ps1 @@ -386,11 +386,11 @@ Describe "Testing Health Checker by Mock Data Imports" { } It "Number of Physical Cores" { - TestObjectMatch "Number of Physical Cores" 48 -WriteType "Yellow" + TestObjectMatch "Number of Physical Cores" 48 -WriteType "Green" } It "Number of Logical Cores" { - TestObjectMatch "Number of Logical Cores" 96 -WriteType "Yellow" + TestObjectMatch "Number of Logical Cores" "96 - Error" -WriteType "Red" } It "Hyper-Threading" {