It’s actually Wednesday here, but yesterday was another “Patch Tuesday” and Microsoft released its update packages.
So – it’s time to patch! ๐
Not sure how you’re patching your machines, but just wanted to make you aware of the nice PowerShell module called PSWindowsUpdate.
You can read more about it on the official PowerShell Gallery page and also here.
In short – this module takes care of controlling Windows Update from within PowerShell on your local and also remote machines.
And… I know it’s not nice like the Windows Update screen, but it does its job! ๐
To make use of it, you’ll have to take care of some minor prerequisites and install it via PowerShell Gallery.
Once done, you can use it to control Windows Update:
To make it easier for you, here is the installation script which takes care of… everything:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# check if you have PSGallery under your PowerShell repositories (and check the installation policy) # if it's not, you can easily register it with "Register-PSRepository -Default" Get-PSRepository # Name InstallationPolicy SourceLocation # ---- ------------------ -------------- # PSGallery Untrusted https://www.powershellgallery.com/api/v2 # NuGet package provider is required - if not present, you'll be asked to install it Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force # Name Version Source Summary # ---- ------- ------ ------- # nuget 2.8.5.208 https://onege... NuGet provider for the OneGet meta-package manager # mark PSGallery as trusted (optional) Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted # are we ready? Get-PSRepository # Name InstallationPolicy SourceLocation # ---- ------------------ -------------- # PSGallery Trusted https://www.powershellgallery.com/api/v2 # install the PSWindowsUpdate module (from PSGallery) Install-Module PSWindowsUpdate # check what's available Get-Command -Module PSWindowsUpdate # CommandType Name Version Source # ----------- ---- ------- ------ # Alias Clear-WUJob 2.2.0.2 PSWindowsUpdate # Alias Download-WindowsUpdate 2.2.0.2 PSWindowsUpdate # Alias Get-WUInstall 2.2.0.2 PSWindowsUpdate # Alias Get-WUList 2.2.0.2 PSWindowsUpdate # Alias Hide-WindowsUpdate 2.2.0.2 PSWindowsUpdate # Alias Install-WindowsUpdate 2.2.0.2 PSWindowsUpdate # Alias Show-WindowsUpdate 2.2.0.2 PSWindowsUpdate # Alias UnHide-WindowsUpdate 2.2.0.2 PSWindowsUpdate # Alias Uninstall-WindowsUpdate 2.2.0.2 PSWindowsUpdate # Cmdlet Add-WUServiceManager 2.2.0.2 PSWindowsUpdate # Cmdlet Enable-WURemoting 2.2.0.2 PSWindowsUpdate # Cmdlet Get-WindowsUpdate 2.2.0.2 PSWindowsUpdate # Cmdlet Get-WUApiVersion 2.2.0.2 PSWindowsUpdate # Cmdlet Get-WUHistory 2.2.0.2 PSWindowsUpdate # Cmdlet Get-WUInstallerStatus 2.2.0.2 PSWindowsUpdate # Cmdlet Get-WUJob 2.2.0.2 PSWindowsUpdate # Cmdlet Get-WULastResults 2.2.0.2 PSWindowsUpdate # Cmdlet Get-WUOfflineMSU 2.2.0.2 PSWindowsUpdate # Cmdlet Get-WURebootStatus 2.2.0.2 PSWindowsUpdate # Cmdlet Get-WUServiceManager 2.2.0.2 PSWindowsUpdate # Cmdlet Get-WUSettings 2.2.0.2 PSWindowsUpdate # Cmdlet Invoke-WUJob 2.2.0.2 PSWindowsUpdate # Cmdlet Remove-WindowsUpdate 2.2.0.2 PSWindowsUpdate # Cmdlet Remove-WUServiceManager 2.2.0.2 PSWindowsUpdate # Cmdlet Reset-WUComponents 2.2.0.2 PSWindowsUpdate # Cmdlet Set-PSWUSettings 2.2.0.2 PSWindowsUpdate # Cmdlet Set-WUSettings 2.2.0.2 PSWindowsUpdate # Cmdlet Update-WUModule 2.2.0.2 PSWindowsUpdate # check which update sources you have installed in your system Get-WUServiceManager # ServiceID IsManaged IsDefault Name # --------- --------- --------- ---- # 7971f918-a847-4430-9279-4a52d1efe18d False True Microsoft Update # 8b24b027-1dee-babb-9a95-3517dfb9c552 False False DCat Flighting Prod # 855e8a7c-ecb4-4ca3-b045-1dfa50104289 False False Windows Store (DCat Prod) # 9482f4b4-e343-43b6-b170-9a65bc822c77 False False Windows Update # install everything that's available via Microsoft Update Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -Verbose # VERBOSE: N1 (10.2.2021. 8:31:41): Connecting to Microsoft Update server. Please wait... # VERBOSE: Found [9] Updates in pre search criteria # VERBOSE: Found [9] Updates in post search criteria # X ComputerName Result KB Size Title # - ------------ ------ -- ---- ----- # 1 N1 Accepted KB4481252 13MB Microsoft Silverlight (KB4481252) # 1 N1 Accepted KB4598459 126MB 2021-02 .NET Core 3.1.12 Security Update for x64 Client # 1 N1 Accepted KB890830 33MB Windows Malicious Software Removal Tool x64 - v5.86 (KB890830) # 1 N1 Accepted KB4601050 65MB 2021-02 Cumulative Update for .NET Framework 3.5 and 4.8 for Windows 10, ... # 1 N1 Accepted KB4052623 6MB Update for Microsoft Defender Antivirus antimalware platform - KB4052623 ... # 1 N1 Accepted KB2267602 697MB Security Intelligence Update for Microsoft Defender Antivirus - KB2267602... # 1 N1 Accepted KB2267602 697MB Security Intelligence Update for Microsoft Defender Antivirus - KB2267602... # 1 N1 Accepted 2MB Hewlett-Packard Development Company, L.P. - Keyboard - Standard 101/102-K... # 1 N1 Accepted KB4601319 103GB 2021-02 Cumulative Update for Windows 10 Version 20H2 for x64-based Syste... # VERBOSE: Accepted [9] Updates ready to Download # 2 N1 Downloaded KB4481252 13MB Microsoft Silverlight (KB4481252) # 2 N1 Downloaded KB4598459 126MB 2021-02 .NET Core 3.1.12 Security Update for x64 Client # 2 N1 Downloaded KB890830 33MB Windows Malicious Software Removal Tool x64 - v5.86 (KB890830) # 2 N1 Downloaded KB4601050 65MB 2021-02 Cumulative Update for .NET Framework 3.5 and 4.8 for Windows 10, ... # 2 N1 Downloaded KB4052623 6MB Update for Microsoft Defender Antivirus antimalware platform - KB4052623 ... # 2 N1 Downloaded KB2267602 697MB Security Intelligence Update for Microsoft Defender Antivirus - KB2267602... # 2 N1 Downloaded KB2267602 697MB Security Intelligence Update for Microsoft Defender Antivirus - KB2267602... # 2 N1 Downloaded 2MB Hewlett-Packard Development Company, L.P. - Keyboard - Standard 101/102-K... # 2 N1 Downloaded KB4601319 103GB 2021-02 Cumulative Update for Windows 10 Version 20H2 for x64-based Syste... # VERBOSE: Downloaded [9] Updates ready to Install # 3 N1 Installed KB4481252 13MB Microsoft Silverlight (KB4481252) # 3 N1 Installed KB4598459 126MB 2021-02 .NET Core 3.1.12 Security Update for x64 Client # 3 N1 Installed KB890830 33MB Windows Malicious Software Removal Tool x64 - v5.86 (KB890830) # 3 N1 Installed KB4601050 65MB 2021-02 Cumulative Update for .NET Framework 3.5 and 4.8 for Windows 10, ... # 3 N1 Installed KB4052623 6MB Update for Microsoft Defender Antivirus antimalware platform - KB4052623 ... # 3 N1 Installed KB2267602 697MB Security Intelligence Update for Microsoft Defender Antivirus - KB2267602... # 3 N1 Installed KB2267602 697MB Security Intelligence Update for Microsoft Defender Antivirus - KB2267602... # 3 N1 Installed 2MB Hewlett-Packard Development Company, L.P. - Keyboard - Standard 101/102-K... # 3 N1 Installed KB4601319 103GB 2021-02 Cumulative Update for Windows 10 Version 20H2 for x64-based Syste... # VERBOSE: Installed [9] Updates # Reboot is required. Do it now? [Y / N] (default is 'N') |
And that’s it – we’re done!
Happy patching!
Cheers!