- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- Thomas Lee
- 105字
- 2021-07-02 18:15:56
There's more...
Two community PowerShell modules available via the Install-Module or the PowerShell Gallery website are useful for working with Windows Update.
PoshWSUS simplifies the management of the WSUS server, wrapping up the interaction with the various objects and enumerations with easy-to-use cmdlets. For example, this command would decline updates for all non-English LanguagePack updates (note the -WhatIf parameter support):
Get-PSWSUSUpdate -IncludeText 'LanguagePack' -ExcludeText 'English' Deny-PSWSUSUpdate -WhatIf
PSWindowsUpdate enables the management and installation of Windows updates provided from a WSUS server, Windows Update, or Microsoft Update. For example, this command will install the newly approved update on DC1 and reboot if required:
Get-WUInstall -AcceptAll -AutoReboot