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.7 Star
(280)
393,439 times
Add to favorites
Windows Update
2/19/2017
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • WSUS PS Script Question
    2 Posts | Last post September 13, 2016
    • Hello, I originally posted to the PS technet forum, and was directed to this forum.  Thanks in advance for help with the below question, and sorry for any confusion with posting to the wrong area.   
      
      https://social.technet.microsoft.com/Forums/windowsserver/en-US/4b66e9c2-6edc-42fb-bb30-6e470b55b8ae/wsus-updates-with-powershell-from-reomte-workstationvm?forum=winserverpowershell#4b66e9c2-6edc-42fb-bb30-6e470b55b8ae
      
      
      Good morning, 
      
      I am fairly new to Powershell scripting, and this is my first post to this forum. Anyway, I've been trying to find a way to manage WSUS assigned Windows updates. Basically, listing and installing assigned updates from one PS session while on my Windows 7 vm would be ideal, avoiding logging into domain controllers, veeam backup servers, etc, several times for patching. 
      
      So far I've been working on this:
      
      1) Invoke-Command  {ipmo \\file-server\share\scripts\WSUS\PSWindowsUpdate}   This is used to import Windows Update modules that I found here: 
      
      https://blogs.technet.microsoft.com/heyscriptingguy/2012/11/08/use-a-powershell-module-to-run-windows-update/
      
      Invoke-Command -Session $s {Get-WUlist}      This works without incident when run remotely on a Win 2008 R2 server, providing a listing of updates. 
      
      2) Invoke-Command  {Get-WUInstall -AcceptAll -verbose -Confirm:$TRUE}
      WARNING: Support local instance only, Continue...
      VERBOSE: Connecting to Windows Server Update Service server. Please wait...
      VERBOSE: Found [1] Updates in pre search criteria
      VERBOSE: Found [1] Updates in post search criteria
      
      When running this module the script will hang and not install the one assigned update applied by WSUS to this particular server.
      
      Any help or direction is appreciated.
      
      Thanks  
    • So I can run updates with further modification of the script, but the remote install will die with the below error.  
      
      I am running this with domain admin creds, and everything is updated to PS5 with PSWindowsUpdate modules imported (locally to the target as well).  
      
      Running the other modules works fine - i.e. WUList, and so on.  
      
      
      Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
          + CategoryInfo          : OperationStopped: (:) [], UnauthorizedAccessException
          + FullyQualifiedErrorId : System.UnauthorizedAccessException
          + PSComputerName        : targetserver
       
      The property 'Updates' cannot be found on this object. Verify that the property exists and can be set.
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : PropertyNotFound
          + PSComputerName        : targertserver
  • failed updates
    3 Posts | Last post September 12, 2016
    • i'm having some trouble using this to install a couple of the march 2013 updates. specifically KB2775511 and KB2670838 on windows server 2008. while most updates install fine using
      
      get-wuinstall -type software -acceptall -autoreboot -verbose
      
      these fail repeatedly, on multiple servers, with the error code 0x800f0902.
      
      if i install the updates manually with the windows update gui, they install fine.
       
    • Hi John,
      Module uses the same mechanisms as the gui version, so it doesn't matter here. It hard to say why, try check Windows Update log. 
    • Hi John,
      
      I am having the same issue with different set of updates and I believe the GUI works differently than the module does. I say that because, I find the CBS.log to be different when using GUI vs Module. I am just curios to know if you had a chance to resolve the problem? if yes, could you please share the same?
      
      Thanks
      Deepak
  • How can I get updates from intranet WSUS server?
    2 Posts | Last post September 02, 2016
    • Hi guys,
      
      I've setup a intranet WSUS server with a URL:“http://my-wsus-server:80”.
      
      And how can I leverage this module to get updates from my WSUS server?
      
      Have you guys ever met the same situation as me?
    • You can write a script to change the registry to point to your WSUS server and also change the UseWUserver value to 1. once done call the get-WUinstall cmdlet with the required parameters 
  • Windows Update module not working for Windows 2012 STD
    1 Posts | Last post September 02, 2016
    • Hi,
      
      I have automated the windows image creation using the answer file which also connects to local WSUS server and download and install the updates from it during the logon phase. I am using the PSWindowsUpdate module and have forcefully pointed the server to local wsus server before calling the Get-WUInstall cmdlet. However for Windows 2012 STD it just import the module and does not do anything after it. The same works fine with Windows 2012 R2. Is there any additional changes to be done for Windows 2012 STD.
      
  • Error 0x800F902 when using get-wuinstall
    1 Posts | Last post September 01, 2016
    • Hi,
      
      When I download and update a bunch of updates with the following command, I always get at least 2-3 updates failed withe error 0x800F902. If I try to download and update them individually using KB parameter, they run OK. Did someone come across the same issue? Here is the command I am trying to use. By the way I am using task scheduler to run the Powershell script. 
      
      get-wuinstall -MicrosoftUpdate -Acceptall -Ignorereboot
      
      Your advise will be really helpful.
      
      Thanks,
      Deepak
  • Typo in code
    1 Posts | Last post August 22, 2016
    • When running the command "Get-WUHistory" there is a typo in the word "history" that displays at the top on the green background:
      "Get update histry for ..."
      
      It should say:
      "Get update history for ..."
  • PSWindowsUpdate and DSC
    1 Posts | Last post August 18, 2016
    • I am trying to get the PSWindowsUpdate Module to work inside a DSC Configuration where Im looking to call Get-WUInstall to install windows updates on a freshly deployed VM.
      
      Im using the Script Resource but i cant seem to get the script to pull the correct True value in the Test Script. Below is the Test Function in the Script Configuration
      
                      TestScript = {
      		$GetUpdates = Get-WUList
      		if ($GetUpdates -ne $null) 
      	{
      		return $true } 
      			else 
      		{
      		return $false }
      	}
      		  }
      
      So if WU-List provides updates the script should return true and run the SetScript - issue is when i run the above in PowerShell it works as expected, if i run in Start-DSCConfiguration it returns false and the SETScript is never run.
      
      Has anyone tried to get PSWindowsUpdates to work in a DSC configuration?
      
      Thanks again for this great script!
      
  • -Type failing
    2 Posts | Last post August 02, 2016
    • So I do infact need to install some specific KP fixes that are not included in the normal update and so I tried to use 
      $KBList = "KB890830", "KB2533552", "KB2539636" (subbed my own in here)
      Get-WUInstall -Type "Software" -KBArticleID $KBList -AcceptAll
      method but I get a failure saying that -Type is not valid
      Did I miss something?
    • '-Type' does not appear to be a valid parameter for the 'Get-WUInstall' command anymore. It may have been for an older version of the module, but it looks like it may have been removed at some point and the examples were not updated to reflect the change.
  • Ignore Optional?
    3 Posts | Last post July 27, 2016
    • I'm looking to, on a new build, install all available updates other than optional. After poking around I found that optional updates can be found using the BrowseOnly field. Is there a way to exclude these? I found this: https://gist.github.com/JohannesM/8f05e911a18ac1b686a6#file-get-wulist-v1-5-1-patch and I now get an 'O' in the status column from Get-WUList, but I can't figure out if there is a way to filter based on that. 
      
      Any help would be appreciated. 
    • I THINK I figured it out with this: 
          Get-WUInstall -MicrosoftUpdate -Criteria "IsInstalled = 0 AND BrowseOnly = 0 AND IsHidden = 0"
    • v1.4.7 - Added AutoSelectOnly param for automatic accept only 'important' updates, ie those which have the status AutoSelectOnWebsites = true.
  • Install only required updates?
    2 Posts | Last post July 27, 2016
    • First off, thanks for the module!
      
      
      Second - Is there a way to install only required updates? (not optional ones)
      
      Thanks again for your work!
    • v1.4.7 - Added AutoSelectOnly param for automatic accept only 'important' updates, ie those which have the status AutoSelectOnWebsites = true.
      
      Found my answer :)
11 - 20 of 231 Items