Updated UpdateLatestCU to use MU Catalog

This commit is contained in:
rbalsleyMSFT
2024-04-12 10:48:53 -07:00
parent 0ce7b7655e
commit 6fd5a4a41f
+9 -8
View File
@@ -2052,25 +2052,26 @@ try {
Add-BootFiles -OsPartitionDriveLetter $osPartitionDriveLetter -SystemPartitionDriveLetter $systemPartitionDriveLetter[1] Add-BootFiles -OsPartitionDriveLetter $osPartitionDriveLetter -SystemPartitionDriveLetter $systemPartitionDriveLetter[1]
#Update latest Cumulative Update #Update latest Cumulative Update
If ($UpdateLatestCU) { #Changed to use MU Catalog instead of using Get-LatestWindowsKB
WriteLog "`$UpdateLatestCU is set to true, checking for latest CU" #The Windows release info page is updated later than the MU Catalog
$LatestKB = Get-LatestWindowsKB -WindowsRelease $WindowsRelease if ($UpdateLatestCU) {
WriteLog "Latest KB for Windows $WindowsRelease found: $LatestKB" Writelog "`$UpdateLatestCU is set to true, checking for latest CU"
$Name = $LatestKB + " " + $WindowsVersion $Name = "Cumulative update for Windows $WindowsRelease Version $WindowsVersion for $WindowsArch"
#Check if $KBPath exists, if not, create it #Check if $KBPath exists, if not, create it
If (-not (Test-Path -Path $KBPath)) { If (-not (Test-Path -Path $KBPath)) {
WriteLog "Creating $KBPath" WriteLog "Creating $KBPath"
New-Item -Path $KBPath -ItemType Directory -Force | Out-Null New-Item -Path $KBPath -ItemType Directory -Force | Out-Null
} }
WriteLog "Searching for $Name from Microsoft Update Catalog and saving to $KBPath" WriteLog "Searching for $name from Microsoft Update Catalog and saving to $KBPath"
$KBFilePath = Save-KB -Name $Name -Path $KBPath $KBFilePath = Save-KB -Name $Name -Path $KBPath
WriteLog "$LatestKB saved to $KBPath\$KBFilePath" WriteLog "Latest CU saved to $KBPath\$KBFilePath"
} }
#Update Latest .NET Framework #Update Latest .NET Framework
if ($UpdateLatestNet) { if ($UpdateLatestNet) {
Writelog "`$UpdateLatestNet is set to true, checking for latest .NET Framework" Writelog "`$UpdateLatestNet is set to true, checking for latest .NET Framework"
$Name = "Cumulative update for .net framework windows $WindowsRelease $WindowsVersion $Architecture" $Name = "Cumulative update for .net framework windows $WindowsRelease $WindowsVersion $WindowsArch"
#Check if $KBPath exists, if not, create it #Check if $KBPath exists, if not, create it
If (-not (Test-Path -Path $KBPath)) { If (-not (Test-Path -Path $KBPath)) {
WriteLog "Creating $KBPath" WriteLog "Creating $KBPath"