From ba1dd3df6b73e3477f03af34bd87fc049608e309 Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Mon, 21 Jul 2025 11:24:44 -0700 Subject: [PATCH] Refactor: Simplify update package file lookup Streamlines the logic for finding Cumulative Update (CU) and Cumulative Update Preview (CUP) files by removing redundant code. The file search now relies directly on a wildcard search using the KB article ID, instead of first attempting a match with a specific filename. This change simplifies the script and makes the discovery process more direct. Also removes commented-out code. --- FFUDevelopment/BuildFFUVM.ps1 | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index 7dd386a..c9c6fa9 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -2093,7 +2093,6 @@ function Get-UpdateFileInfo { $links = Get-KBLink -Name $kb foreach ($link in $links) { $fileName = ($link -split '/')[-1] - # $url = $link $architectureMatch = $false if ($link -match 'x64' -or $link -match 'amd64') { @@ -4683,28 +4682,14 @@ try { WriteLog "Latest SSU identified as $SSUFilePath" } if ($cuUpdateInfos.Count -gt 0) { - # Use the actual downloaded file name from the update info - $CUFileName = $cuUpdateInfos[0].Name - $CUPath = (Get-ChildItem -Path $KBPath -Filter $CUFileName -Recurse).FullName if (-not $CUPath) { - # If exact match fails, try to find by KB article ID $CUPath = (Get-ChildItem -Path $KBPath -Filter "*$cuKbArticleId*" -Recurse | Select-Object -First 1).FullName - if ($CUPath) { - $CUFileName = Split-Path $CUPath -Leaf - } } WriteLog "Latest CU identified as $CUPath" } if ($cupUpdateInfos.Count -gt 0) { - # Use the actual downloaded file name from the update info - $CUPFileName = $cupUpdateInfos[0].Name - $CUPPath = (Get-ChildItem -Path $KBPath -Filter $CUPFileName -Recurse).FullName if (-not $CUPPath) { - # If exact match fails, try to find by KB article ID $CUPPath = (Get-ChildItem -Path $KBPath -Filter "*$cupKbArticleId*" -Recurse | Select-Object -First 1).FullName - if ($CUPPath) { - $CUPFileName = Split-Path $CUPPath -Leaf - } } WriteLog "Latest Preview CU identified as $CUPPath" }