Difference between revisions of "Windows Update Powershell Commands"

From DFWLPiki
Jump to: navigation, search
Line 22: Line 22:
 
Show all available commands:
 
Show all available commands:
 
  Get-Command -module PSWindowsUpdate
 
  Get-Command -module PSWindowsUpdate
 +
 +
You may need to update to powershell 5.1 first:
 +
https://www.microsoft.com/en-us/download/details.aspx?id=54616

Revision as of 13:51, 11 April 2020

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:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-Module -Name PSWindowsUpdate -Confirm:$false -Force

Apply all available updates:

Install-WindowsUpdate -AcceptAll

List all available updates

Get-WUList

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

You may need to update to powershell 5.1 first:

https://www.microsoft.com/en-us/download/details.aspx?id=54616