kbupdate
kbupdate copied to clipboard
Endless warnings and failed download
The below code, when run as administrator in Powershell ISE in Windows 10 Enterprise, results in a few files downloaded, but then endless repeated messages like
WARNING: [12:09:47][Start-BitsJobProcess] Failure for 2023-02 Cumulative Update for .NET Framework 4.8 for Windows Server 2016 for x64 (KB5022503) | The system cannot find the file specified. (Exception from HRESULT: 0x80070002) WARNING: [12:09:47][Start-BitsJobProcess] Failure for kbupdate | The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
`$kbs = Get-KbUpdate -Source Web -MaxPages 9 -OperatingSystem 'Windows Server 2016' -Pattern 'NET Framework' -Exclude 1709, 1803 $kbs
foreach ($kb in $kbs) { $file = Split-Path $kb.Link -Leaf $json = $file.Replace('.msu','.json') Write-Host "$($kb.Id) $($file) $($kb.Title)"
if(!(Test-Path $json -PathType Leaf ))
{
Get-KbUpdate $kb.UpdateId | Save-KbUpdate -AllowClobber
$kb | ConvertTo-Json | Out-File $json
$fileItem = Get-Item $file
(Get-Item $json).CreationTime = $fileItem.CreationTime
(Get-Item $json).LastAccessTime = $fileItem.LastAccessTime
(Get-Item $json).LastWriteTime = $fileItem.LastWriteTime
Write-Output "$($kb.Id) $($file) $($kb.Title)" | Out-File '_updates.lst' -Append
}
} `
I am unable to duplicate this issue on several different machines.
In my case I lost internet access during one of the downloads and had to restart the script. Maybe try running the script. Then in the middle of one of the downloads cut internet and then CTRL+C to break out. After the internet restores, run the script again.