Enhances driver package representation in Get-DellLatestDriverPackages function by adding a human-readable driver name. This change captures the display name from the XML, sanitizes it for display purposes, and ensures proper formatting by collapsing multiple spaces and replacing illegal characters. This improves clarity and usability when displaying driver information.

This commit is contained in:
rbalsleyMSFT
2025-11-05 17:30:53 -08:00
parent 667edf3724
commit 11b3e120e2
@@ -188,10 +188,19 @@ function Get-DellLatestDriverPackages {
# Build a deterministic sortable key: zero-pad each numeric segment to 6 digits # Build a deterministic sortable key: zero-pad each numeric segment to 6 digits
$versionSortable = ($versionArr | ForEach-Object { $_.ToString('D6') }) -join '-' $versionSortable = ($versionArr | ForEach-Object { $_.ToString('D6') }) -join '-'
# Capture a humanreadable driver name (preserve spaces like HP/Lenovo; remove only illegal path chars and extra whitespace)
$displayNode = $comp.SelectSingleNode("*[local-name()='Name']/*[local-name()='Display']")
$nameRaw = if ($displayNode) { $displayNode.InnerText.Trim() } else { $fileName }
# Remove characters not suitable for display (and disallowed in file names) but keep spaces
$nameDisplay = $nameRaw -replace '[\\\/:\*\?\"\<\>\|]', ' ' -replace '[,]', '-'
# Collapse multiple spaces to single
$nameDisplay = ($nameDisplay -replace '\s+', ' ').Trim()
$rawPackages.Add([pscustomobject]@{ $rawPackages.Add([pscustomobject]@{
Path = $path Path = $path
DownloadUrl = $downloadUrl DownloadUrl = $downloadUrl
FileName = $fileName FileName = $fileName
Name = $nameDisplay
Category = $category Category = $category
VendorVersion = $vendorVersion VendorVersion = $vendorVersion
VersionArray = $versionArr VersionArray = $versionArr
@@ -225,6 +234,7 @@ function Get-DellLatestDriverPackages {
Path = $pkg.Path Path = $pkg.Path
DownloadUrl = $pkg.DownloadUrl DownloadUrl = $pkg.DownloadUrl
DriverFileName = $pkg.FileName DriverFileName = $pkg.FileName
Name = $pkg.Name
Category = $pkg.Category Category = $pkg.Category
VendorVersion = $pkg.VendorVersion VendorVersion = $pkg.VendorVersion
DateTime = $pkg.DateTime DateTime = $pkg.DateTime