Normalizes model display in Get-DellClientModels to prevent duplicate brand names in output.

This commit is contained in:
rbalsleyMSFT
2025-10-23 12:27:46 -07:00
parent 66a9026b8f
commit 7dd002396f
@@ -90,7 +90,20 @@ function Get-DellClientModels {
$pathAttr = $manifestInfo.GetAttribute('path') $pathAttr = $manifestInfo.GetAttribute('path')
if (-not $pathAttr) { continue } if (-not $pathAttr) { continue }
$cabUrl = 'https://downloads.dell.com/' + $pathAttr $cabUrl = 'https://downloads.dell.com/' + $pathAttr
$modelDisplay = "$brandDisplay $modelNumber ($systemId)" # 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"
}
}
elseif ($brandDisplay -and -not $modelNumber) {
$prefixedModelNumber = $brandDisplay
}
$modelDisplay = "$prefixedModelNumber ($systemId)"
$models.Add([pscustomobject]@{ $models.Add([pscustomobject]@{
Brand = $brandDisplay Brand = $brandDisplay
ModelNumber = $modelNumber ModelNumber = $modelNumber