From 6f98473009c1b8ac2b8f066a5c7a00424855928d Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Wed, 6 Aug 2025 17:46:13 -0700 Subject: [PATCH] Refines driver mapping logic and adds diagnostic logging Improves JSON parsing of the driver mapping file to handle different file structures more reliably. Adds logging to show all potential driver mapping rules that match the current system, making it easier to diagnose rule selection. --- FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 b/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 index 93579cf..ac9e82f 100644 --- a/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 +++ b/FFUDevelopment/WinPEDeployFFUFiles/ApplyFFU.ps1 @@ -545,7 +545,7 @@ if (Test-Path -Path $driverMappingPath -PathType Leaf) { WriteLog "Detected System: Manufacturer='$systemManufacturer', Model='$systemModel'" # Load and parse the mapping file, ensuring it's always an array - $driverMappings = @(Get-Content -Path $driverMappingPath -Raw | ConvertFrom-Json -ErrorAction SilentlyContinue) + $driverMappings = Get-Content -Path $driverMappingPath | Out-String | ConvertFrom-Json -ErrorAction SilentlyContinue # Find all matching rules and select the most specific one $matchingRules = @() @@ -553,6 +553,7 @@ if (Test-Path -Path $driverMappingPath -PathType Leaf) { # Use -like for wildcard matching. # This checks if the system model starts with the rule model, or vice-versa, for flexibility. if ($systemManufacturer -like "$($rule.Manufacturer)*" -and ($systemModel -like "$($rule.Model)*" -or $rule.Model -like "$systemModel*")) { + WriteLog "Match found: Manufacturer='$($rule.Manufacturer)', Model='$($rule.Model)'" $matchingRules += $rule } }