potatoqualitee / kbupdate

🛡 KB Viewer, Saver, Installer and Uninstaller
MIT License
326 stars 48 forks source link

Install specific KB from a repository Path #191

Closed steviecoaster closed 1 year ago

steviecoaster commented 1 year ago

Using Get-KbNeededUpdate combined with Save-KBUpdate I was able to create a specific repository to store the required update files. I proceeded to attempt to install a specific update using the repository, but all update files found in the repository were found.

Install-KbUpdate -HotfixId KB5017263 -RepositoryPath C:\playground\ -ComputerName localhost performed the following actions:

ComputerName : localhost
Title        : 2022-09 Cumulative Update Preview for .NET Framework 3.5, 4.7.2 and 4.8 for Windows Server 2019 for x64
               (KB5017855)
ID           : 91f255aa-7c9d-4b56-8886-22e8cf30d522
Status       : Succeeded
HotFixId     : 5017855
Update       : System.__ComObject

ComputerName : localhost
Title        : Security Intelligence Update for Microsoft Defender Antivirus - KB2267602 (Version 1.375.1172.0)
ID           : 835d0136-85af-4519-afcb-86b904432fb7
Status       : Succeeded
HotFixId     : 2267602
Update       : System.__ComObject

However, I was expecting just:

ComputerName : localhost
Title        : Security Intelligence Update for Microsoft Defender Antivirus - KB2267602 (Version 1.375.1172.0)
ID           : 835d0136-85af-4519-afcb-86b904432fb7
Status       : Succeeded
HotFixId     : 2267602
Update       : System.__ComObject
potatoqualitee commented 1 year ago

That was my expectation as well! 😱 I'll take a look at this tonight.

potatoqualitee commented 1 year ago

I think this may just impact localhost + kb. When I do this, it's not supposed to say Build needed updates because it was already told which updates will be needed. Fixing now.

Install-KbUpdate -ComputerName localhost -HotfixId kb5017265 -RepositoryPath \\san\share\updates -Verbose             

VERBOSE: [16:00:09][Install-KbUpdate] Processing 
VERBOSE: [16:00:09][Install-KbUpdate] Setting method to Windows Update
VERBOSE: [16:00:09][Install-KbUpdate] Method is WindowsUpdate
VERBOSE: [16:00:09][Install-KbUpdate] Using jobs for update to localhost
VERBOSE: [16:00:09][Start-JobProcess] Processing jobs
VERBOSE: Exporting function 'Get-NetConnectionProfile'.
VERBOSE: Exporting function 'Set-NetConnectionProfile'.
VERBOSE: Exporting function 'New-PSWorkflowSession'.
VERBOSE: Exporting alias 'nwsn'.
VERBOSE: [16:00:12][<ScriptBlock>] Using the Windows Update method
VERBOSE: [16:00:12][<ScriptBlock>] Build needed updates
VERBOSE: [16:00:25][<ScriptBlock>] Processing 1 updates
VERBOSE: [16:00:25][<ScriptBlock>] Accepting EULA for SQL Server 2019 RTM Cumulative Update (CU) 18 KB5017593
VERBOSE: [16:00:25][<ScriptBlock>] Checking to see if IsDownloaded (True) is true
VERBOSE: [16:00:25][<ScriptBlock>] Updates for SQL Server 2019 RTM Cumulative Update (CU) 18 KB5017593 do not need to be downloaded
VERBOSE: [16:00:25][<ScriptBlock>] Creating installer object for SQL Server 2019 RTM Cumulative Update (CU) 18 KB5017593
VERBOSE: [16:00:25][<ScriptBlock>] Adding updates via updateinstall
VERBOSE: [16:00:25][<ScriptBlock>] Installing updates