Windows Update PowerShell Module

This function is a piece of PSWindowsUpdate module to manage Windows Update on a computer system running Windows. Whole module contain set of functions to check, download and install updates from PowerShell.

4.6 Star
734,100 times
Add to favorites
Windows Update
E-mail Twitter Digg Facebook
  • Inconsistent "Unknown failure"
    1 Posts | Last post September 23, 2019
    • Hi All, wonder if anyone has a constructive suggestion:
      I get frequent but intermittent errors from different PSWindowsUpdate cmdlets from different target computers, e.g.:
      + CategoryInfo          : PermissionDenied: (:) [Get-WindowsUpdate], Exception
      + FullyQualifiedErrorId : Unknown,PSWindowsUpdate.GetWindowsUpdate
      Some commands seem better e.g. Get-WURebootStatus, but others are more troublesome, e.g.: Get-WULastResults or Get-WindowsUpdate.
      Sometimes the remote target computers respond ok other times they error. Sometimes it works when an admin is logged on remotely, but that doesn't solve it consistently.
      The errors occur even with Windows Firewall disabled on both 'server' and 'client'.
      Managing server: WindowsServer2016; PSWindowsUpdate version
      Target client computers: 2016, also 2012R2, 2019;  PSWindowsUpdate version
      I installed the module on remote systems like this:
      Install-Module PSWindowsUpdate -Scope AllUsers -Force ; Import-Module PSWindowsUpdate
  • LocalPSWUSource
    3 Posts | Last post September 10, 2019
    • I am trying to deploy the module remotely, and when i do i get the error below.  I am looking at the parameter in the script and dont really know what to do with this error.  I have fixed a few other issues, like getting to run in SSL, but cannot figure out what to do for this error, hoping someone has had this issue and can provide some guidance.  
      Update-WUModule : A parameter cannot be found that matches parameter name 'LocalPSWUSource'.
      At C:\Windows\System32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\invoke-wuinstall.ps1:111 char:48
      + ...   Update-WUModule -ComputerName $Computer    -LocalPSWUSource (Get-Mo ...
      +                                                  ~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Update-WUModule], ParameterBindingException
          + FullyQualifiedErrorId : NamedParameterNotFound,PSWindowsUpdate.UpdateWUModule
    • figured it out
      [String]$LocalPSWUSource = "C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate",
    • steak 1986, how did you get SSL running?
  • Returning To Variables
    1 Posts | Last post September 06, 2019
    • The output for the command had 3 different lines for KBs. One for Accepted, one for Download, One for Install:
      X ComputerName Result     KB          Size Title
      - ------------ ------     --          ---- -----
      1 SHLW3265     Accepted   KB4511555   59MB XXX
      2 SHLW3265     Downloaded KB4511555   59MB XXX
      3 SHLW3265     Installed  KB4511555   59MB XXX
      However, if you write to a variable ($install = Install-WindowsUpdates) and echo the variable you get three lines all saying installed.  Has anyone been able to parse it similar to the output results:
      X ComputerName Result     KB          Size Title
      - ------------ ------     --          ---- -----
      3 SHLW3265     Installed  KB4511555   59MB XXX
      3 SHLW3265     Installed  KB4511555   59MB XXX
      3 SHLW3265     Installed  KB4511555   59MB XXX
      Or do I just not know what I am doing.
  • Latest PSWindowsUpdate Version
    1 Posts | Last post September 05, 2019
    • The latest versions can be found at the PowerShell Gallery home page for this module:
      Of course, running <inmo PSWindowsUpdate> should normally install the latest version at the time of invocation.  Don't forget to import afterwards with <ipmo PSWindowsUpdate> as inmo (alias for import-module) simply downloads the module to the default PowerShell module directory.
      Not sure why this page isn't being updated anymore. :(
  • Newbie - 2 Questions
    2 Posts | Last post September 05, 2019
    • Hello.
      I am quite new to these scripts. I have three questions. Hope they can answer with someone.
      I want to run ALL updates & restarts every Sunday at 03:00 if necessary.
      Question 1)
      Have I read the instructions correctly?
      #Get-WUInstall -WindowsUpdate -IgnoreUserInput -WhatIf -Verbose -AcceptAll –AutoReboot
      Question 2)
      Sometimes someone forgets to log off a user. Is there a "Force" command for restarting?
      Question 3)
      Server A need "Get-WUInstall -MicrosoftUpdate"
      Server B need "Get-WUInstall -WindowsUpdate" (MicrosoftUpdate isn´t working)
      I never noticed it before! Where can this be unified?
      Thank you, Lars
    • Answer 1)
      I think you need to use Invoke-WUJob for scheduled updates.  This is also the proper technique for updating remote machines from your local admin PowerShell console.  Otherwise, almost on your Get-WUInstall line.  Add the -install switch to make sure they do install.
      Answer 2)
      I'm fairly certain that autoreboot will force the reboot even on active interactive sessions, e.g. it seems to be similar to the <Restart-Computer -force> command.
      Answer 3)
      If Microsoft Update isn't working, you might try to use the DISM tool, SFC /scannow, and possibly even the WMI diagnostic tool to get that working.  Even if you don't necessarily need it to work, it's good practice to utilize the aforementioned tools for experience and skill building. ;)
  • What special permission is required for invoke-wujob on remote computer?
    1 Posts | Last post September 04, 2019
    • I am trying to install update on remote computer using invoke-wujob. I am able to use invoke-command to launch get-windowsupdate to obtain the available updates on the remote computer (server 2016). However, when I tried using invoke-wujob to launch get-windowsupdate (not try to install yet) and it failed with the following message. Does anyone know what specific permission I need for the invoke-wujob cmdlet.
      + CategoryInfo          : OperationStopped: (dell-sm:String) [Invoke-WUJob], PSRemotingTransportException
      + FullyQualifiedErrorId : JobFailure,PSWindowsUpdate.InvokeWUJob
      + PSComputerName        : server1
      invoke-command -computername server1 -cred ${get-cred) -scriptblock {get-windowsupdate}
      invoke-wujob -runnow -computername server1 -cred $(get-cred) -script {get-windowsupdate}
  • invoke-wuinstall : the term 'invoke-wuinstall' is not recognized
    2 Posts | Last post August 20, 2019
    • I have imported the PSwindowsupdate module, but when try to access the invoke-wuinstall module i am getting its not a recognized command. Can you please help on this? 
    • Its Invoke-WUJob now.
  • External tools like WuInstall
    2 Posts | Last post July 19, 2019
    • I am not so great at scripting but I consider using a command line tool for searching and installing updates via command line / simple powershell scripts - stumbled over WuInstall ( - does any one of you have any experience with that one, is it useful for production environments?
      Or do you recommend to powershell-script it ourselves as opposed to external tools?
    • Hi, we are using WuInstall and it works great for us!  They recently posted a step by step guide on how to force Windows 10 updates to install using the command line.
  • Error Message when using Install-WindowsUpdate
    1 Posts | Last post July 19, 2019
    • Environment: Domain 
      GPO and Firewall Policies allow WinRM ( and (
      Getting the following below:
      Install-WindowsUpdate : [CVWCSX6] Connecting to remote server CVWCSX6 failed with the following error message : The WinRM client cannot process the request.  Default credentials with Negotiate over HTTP can be used only if the target machine is part of the TrustedHosts list or the Allow implicit credentials 
      for Negotiate option is specified. For more information, see the about_Remote_Troubleshooting Help topic.
      At line:1 char:1
      + Install-WindowsUpdate -ComputerName CVWCSX6 -MicrosoftUpdate -AcceptA ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : OpenError: (CVWCSX6:String) [Get-WindowsUpdate], PSRemotingTransportException
          + FullyQualifiedErrorId : ExplicitCredentialsRequired,PSSessionStateBroke
      Get-WUInstall seems to work - shows list but doesn't seem to install the updates
      Get-WUInstall -ComputerName CVWCSX6 -AcceptAll -SendReport 
  • The update could not be uninstalled because..
    1 Posts | Last post June 26, 2019
    • I am getting the following error when I try to remove KB's. 
      PS C:\windows\system32> Uninstall-WindowsUpdate -KBArticleID KB4462223 -Confirm:$false -Verbose
      VERBOSE: Performing the operation "(6/25/2019 2:04:59 PM) Remove (WUApi) Windows Update: Security Update for
       Microsoft Office 2010 (KB4462223) 32-Bit Edition" on target "OEM1211".
      WARNING: Exception from HRESULT: 0x80240028. The update could not be uninstalled because the request did not
       originate from a WSUS server.
      All of my Updates have came down via Windows update (No WSUS).
      Anybody seen this issue?
11 - 20 of 357 Items