Windows Update Powershell Commands: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Category:Windows '''The PSWindowsUpdate set of commands is required.''' Apply all available updates: Set-ExecutionPolicy -ExecutionPolicy Bypass -Force Import-Module PS...") |
No edit summary |
||
| (11 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:Windows]] | [[Category:Windows]] | ||
'''The PSWindowsUpdate set of commands is required.''' | '''The PSWindowsUpdate set of commands is required.''' | ||
If necessary, remove the older module with admin command promt: | |||
@RD /S /Q C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\ | |||
Install the PSWindowsUpdate module and install all available windows updates: | |||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force | |||
Install-Module -Name PSWindowsUpdate -Confirm:$false -Force | |||
Install-WindowsUpdate -AcceptAll -AutoReboot | |||
Apply all available updates: | Apply all available updates: | ||
Install-WindowsUpdate -AcceptAll | |||
or | |||
Install-WindowsUpdate -AcceptAll -AutoReboot | |||
List all available updates | List all available updates | ||
Get-WindowsUpdate | |||
Get- | Show current update settings, including WSUS source server if any: | ||
Get-WUSettings | |||
Show Updates sources and which is default (Desired state is usually "true" for Windows Server Update Service) | Show Updates sources and which is default (Desired state is usually "true" for Windows Server Update Service) | ||
Get-WUServiceManager | Get-WUServiceManager | ||
Show all available commands: | |||
Get-Command -module PSWindowsUpdate | |||
For servers older than 2016, you may need to update to powershell 5.1 first: | |||
https://www.microsoft.com/en-us/download/details.aspx?id=54616 | |||
Here is converting from old module to new all in one shot: | |||
@RD /S /Q C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\ | |||
powershell | |||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |||
Install-Module -Name PSWindowsUpdate -Confirm:$false -Force | |||
Install-WindowsUpdate -AcceptAll | |||
Latest revision as of 15:14, 25 September 2021
The PSWindowsUpdate set of commands is required. If necessary, remove the older module with admin command promt:
@RD /S /Q C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\
Install the PSWindowsUpdate module and install all available windows updates:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module -Name PSWindowsUpdate -Confirm:$false -Force Install-WindowsUpdate -AcceptAll -AutoReboot
Apply all available updates:
Install-WindowsUpdate -AcceptAll
or
Install-WindowsUpdate -AcceptAll -AutoReboot
List all available updates
Get-WindowsUpdate
Show current update settings, including WSUS source server if any:
Get-WUSettings
Show Updates sources and which is default (Desired state is usually "true" for Windows Server Update Service)
Get-WUServiceManager
Show all available commands:
Get-Command -module PSWindowsUpdate
For servers older than 2016, you may need to update to powershell 5.1 first:
https://www.microsoft.com/en-us/download/details.aspx?id=54616
Here is converting from old module to new all in one shot:
@RD /S /Q C:\windows\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\ powershell [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Install-Module -Name PSWindowsUpdate -Confirm:$false -Force Install-WindowsUpdate -AcceptAll