-
Notifications
You must be signed in to change notification settings - Fork 51
Home
Chrissy LeMaire edited this page Sep 27, 2022
·
1 revision
Here's a good kbupdate demo!
# Get stuff
Get-KbUpdate -Pattern KB2416447, KB979906
Get-KbUpdate -Pattern KB2416447, KB979906 -Latest
Get-KbUpdate -Pattern KB2416447, KB979906 -Latest | Save-KbUpdate -Path C:\temp\updates
# Use alternative source (it does auto-detect)
Get-KbUpdate -Source Database -Pattern KB5017316
# Limit results
Get-KbUpdate KB5017903 -Architecture x64
(Get-KbUpdate KB5017903).Count
(Get-KbUpdate KB5017903 -Architecture x64).Count
Get-KbUpdate -Pattern KB5010475 -Simple -ComputerName sqlcs | Format-List
# Get needed updates using current windows update source
Get-KbNeededUpdate -ComputerName sqlcs
# all in one -- this is time consuming, skip
Get-KbNeededUpdate -ComputerName sqlcs, localhost -OutVariable neededpatches
$neededpatches | Where-Object Title -match '2022-02 Cumulative Update Preview for .NET Framework 3.5 and 4.8' | Save-KbUpdate -Path \\san\share\updates
$neededpatches | Where-Object Title -match '2022-02 Cumulative Update Preview for .NET Framework 3.5 and 4.8' | Install-KbUpdate -RepositoryPath \\san\share\updates
# Get needed updates using a catalog db source
Save-KbScanFile -OutVariable scanfile
Get-KbNeededUpdate -ComputerName sqlcs -ScanFile $scanfile -Force
# Get complete list of installed software
Get-KbInstalledSoftware -ComputerName sqlcs, sql01 -Verbose | Out-GridView
# Get needed updates using offline db
Save-KbScanFile -OutVariable needed
Get-KbNeededUpdate -ComputerName sqlcs -ScanFilePath $needed -Force -Verbose
# Install
$parms = @{
ComputerName = 'workstation'
Path = 'C:\temp\sqlserver2019-kb5016394-x64_b196811983841da3a07a6ef8b776c85d942a138f.exe'
Verbose = $true
}
Install-KbUpdate @parms
# Check your work
Get-KbInstalledSoftware -Pattern KB5016394
Uninstall-KbUpdate -ComputerName workstation -HotfixId KB5016394
# Install needed updates
Install-KbUpdate -ComputerName sqlcs, server01 -AllNeeded -Verbose | Out-GridView
# Uninstall galore
Get-KbInstalledSoftware -ComputerName sqlcs, server01 -Verbose |
Where-Object Summary -notmatch "cannot be removed" |
Where-Object Name -notmatch "Update for Microsoft Defender" |
Out-GridView -Passthru | Uninstall-KbUpdate -Confirm:$false
# configs
Get-PSFConfig -Module kbupdate
Get-PSFConfig -Module PSRemoting
Set-PSFConfig -FullName kbupdate.app.source -Value Database
Reset-PSFConfig -Module kbupdate
Get-PSFConfig -Module kbupdate
# WSUS
Connect-KbWsusServer -ComputerName server01
Get-KbUpdate -Pattern powershell -Verbose
Disconnect-KbWsusServer
### π₯π₯π₯ DRUM ROLL π₯π₯π₯ ###
# Download latest updates
Get-KbUpdate -Since (Get-Date).AddDays(-30) -Architecture x64 |
Out-GridView -Passthru |
Save-KbUpdate -Path C:\temp\burn_to_dvd
# Download Windows Update Client scan file
Save-KbScanFile -Path C:\temp\burn_to_dvd
### πΏπΏπΏ BURN TO DVD πΏπΏπΏ ###
### πππ TRANSFER TO OFFLINE NETWORK πππ ###
# Tell Install-KbUpdate to check for all needed updates
# and point the RepositoryPath to a network server. The
# servers will grab what they need.
$params = @{
ComputerName = "sql01", "sqlcs"
AllNeeded = $true
ScanFilePath = "\\san\share\updates\wsusscn2.cab"
RepositoryPath = "\\san\share\updates"
}
Install-KbUpdate @params