Normalizes model display in Get-DellClientModels function by utilizing GroupManifest Display CDATA when available. Implements fallback logic to construct model names from brand and model nodes, improving clarity and consistency in model representation.

This commit is contained in:
rbalsleyMSFT
2025-11-05 15:33:15 -08:00
parent 4a10e27ddf
commit 667edf3724
@@ -90,20 +90,30 @@ function Get-DellClientModels {
$pathAttr = $manifestInfo.GetAttribute('path')
if (-not $pathAttr) { continue }
$cabUrl = 'https://downloads.dell.com/' + $pathAttr
# Normalize model display to avoid duplicate brand (e.g. Latitude Latitude 13 (0432))
$prefixedModelNumber = $modelNumber
if ($modelNumber -and $brandDisplay) {
if ($modelNumber.StartsWith($brandDisplay,[System.StringComparison]::OrdinalIgnoreCase)) {
$prefixedModelNumber = $modelNumber
}
else {
$prefixedModelNumber = "$brandDisplay $modelNumber"
}
# Normalize model display using GroupManifest Display CDATA if available (strip 'PDK Catalog for')
$gmDisplayNode = $doc.SelectSingleNode("/*[local-name()='GroupManifest']/*[local-name()='Display']")
$modelFull = $null
if ($gmDisplayNode -and $gmDisplayNode.InnerText) {
$rawDisplay = $gmDisplayNode.InnerText.Trim()
$modelFull = ($rawDisplay -replace '^\s*PDK Catalog for\s+','').Trim()
}
elseif ($brandDisplay -and -not $modelNumber) {
$prefixedModelNumber = $brandDisplay
if ([string]::IsNullOrWhiteSpace($modelFull)) {
# Fallback: assemble from brand/model nodes (legacy heuristic)
$prefixedModelNumber = $modelNumber
if ($modelNumber -and $brandDisplay) {
if ($modelNumber.StartsWith($brandDisplay,[System.StringComparison]::OrdinalIgnoreCase)) {
$prefixedModelNumber = $modelNumber
}
else {
$prefixedModelNumber = "$brandDisplay $modelNumber"
}
}
elseif ($brandDisplay -and -not $modelNumber) {
$prefixedModelNumber = $brandDisplay
}
$modelFull = $prefixedModelNumber
}
$modelDisplay = "$prefixedModelNumber ($systemId)"
$modelDisplay = "$modelFull ($systemId)"
$models.Add([pscustomobject]@{
Brand = $brandDisplay
ModelNumber = $modelNumber