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.

79,618 times
Add to favorites
Windows Update
E-mail Twitter Digg Facebook
Sign in to ask a question

  • Invoke-WUInstall
    1 Posts | Last post June 04, 2014
    • Hello, I seem to unable to get the Invoke-WUInstall command to run. When i run this it create the task on the target server but that task fails to run. This is on server 2012 / 2012 R2. It would also be nice if it would use my account for the task rather then the local system account.
  • Problems with -AutoSelectOnly parameter
    1 Posts | Last post June 03, 2014
    • The -AutoSelectOnly parameter seems to be not working as expected.  Both the Pre search criteria and the Post search criteria show all available updates.  But the download step only downloads a subset of available updates, unfortunately this subset is not the same as the list of updates which are shown as preselected when I run wuapp.exe.  For example a fresh install of Win7SP1 with IE11 and .Net 4.5.1 and Office 2010 installed will find a total of 224 possible updates from Microsoft updates (important plus optional).  So when using -AutoSelectOnly parameter, both pre and post criteria list this number.  In wuapp.exe there are 181 preselected updates (in other words important updates).  But the PS module only downloads 140 of them.  I am not sure why the discrepancy. To get around this I have had to resort to usage of -NotCategory and -NotTitle instead and abandon use of -AutoSelectOnly parameter.
  • get-wulist remotecomputer problem
    1 Posts | Last post May 23, 2014
    • Hi all,
      I test this module, and i dont get any information from remote server.
      Test from my PC:
      PS C:\> Get-WUList -ComputerName nas
      PS C:\> Get-WUList -ComputerName nas -Debuger
      DEBUG: STAGE 0: Prepare environment
      DEBUG: Check if ComputerName in set
      DEBUG: STAGE 1: Get updates list
      DEBUG: Create Microsoft.Update.Session object for nas
      DEBUG: Create Microsoft.Update.Session.Searcher object for nas
      DEBUG: Set source of updates to default (for nas) Windows Update
      DEBUG: Set pre search criteria: IsInstalled = 0
      DEBUG: Search criteria is: IsInstalled = 0
      PS C:\>
      Test from server:
      PS C:\> Get-WUList
      ComputerName Status KB          Size Title
      ------------ ------ --          ---- -----
      NAS          ------ KB2668562   6 MB Microsoft Silver
      NAS          D----- KB2953522  15 MB Sicherheitsupdat
      NAS          D----- KB890830    7 MB Windows-Tool zum
      NAS          D----- KB2965065 401 KB Update für Windo
      NAS          D----- KB2920189  31 KB Sicherheitsupdat
      NAS          D----- KB2926765  13 MB Sicherheitsupdat
      NAS          D----- KB2931358 322 KB Sicherheitsupdat
      NAS          D----- KB2931366 584 KB Sicherheitsupdat
      NAS          D----- KB2954879 105 KB Update für .NET
      NAS          D----- KB2950153 213 KB Update für Windo
      NAS          ------ KB2955164  97 MB Update für Windo
      NAS          D----- KB2956575  13 MB Update für Windo
      NAS          D----- KB2958262   2 MB Update für Windo
      What is the problem?
      I deactivate the uac at the server, but no success.
      What should i do?
      Thx for the great modules.
  • PS v3 requirement
    1 Posts | Last post May 14, 2014
    • Hi,
      Your module seems to require PS v3 as it uses, among other, Unblock-File. You should update your documentation as it precises PS v2 as a prereq.
      Thanks for you work.
  • Automate WU-Install Windows 7
    7 Posts | Last post April 22, 2014
    • HI
      I'm having an issue automating this script from a batch file. 
      Using the following code the script runs in Windows 8 and 8.1, however it gives an error in Windows 7:
      powershell set-executionpolicy remotesigned
      powershell import-module pswindowsupdate
      powershell get-wuinstall -acceptall -ignorereboot
      The error reads as follows (in 7):
      The term 'get-wuinstall' is not recognised as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
      At line:1 char:14
      * get-wuinstall <<<<  -acceptall -ignorereboot
           +CategoryInfo     : ObjectNotFound: <get-wuinstall:String> [], comma
           +FullyQualifiedErrorIF  : CommandNotFoundExcception
      Any ideas?
    • Hello, I have exactly the same problem.
      When I just run powershell as admin and run these commands:
      :\> set-executionpolicy remotesigned
      :\> import-module pswindowsupdate
      :\> get-wuinstall -acceptall -ignorereboot
      it works like a charm, but when I call the three lines from a batch file, the same thing happens as with Jason.
      Running the exact same batch file in windows 8.0 and 8.1 works like a charm.
      Maybe there is a difference in windows 7 powershell to windows 8 powershell (even though they're both version 2.0...
      Would really appreciate anyone's input on this...
    • To add insult to injury,
      When launching powershell from an elevated command prompt (just execute powershell.exe) I get a powershell prompt (I assume also elevated) Running the commands mentioned before I get the same errors. So I assume there is an issue calling powershell.exe (perhaps something to do with permissions?).
    • I'm glad to hear I'm not the only one.
      I have replicated the elevated command prompt issue as well. Still stuck for a solution though.
      I've looked into methods to call powershell as administrator from command line but as I'm using this in audit mode the administrator account doesn't have a password and the call to run as admin requires a passworded account. So I got stuck there as well.
    • Just create powershellscript with those three commands and call that from cmd batch
    • So my RunUpdate.ps1 has the following in it:
      Set-ExecutionPolicy RemoteSigned
      Import-Module PSWindowsUpdate
      Get-WUInstall -NotTitle "Bing" -acceptall -IgnoreReboot
      But if I call that from update.cmd it doesn't seem to do anything and it exits shortly after starting with no output.
      Update.cmd looks like this:
      powershell -executionpolicy remotesigned -file C:\Temp\RunUpdate.ps1
    • Forget that! Solved.
      From command line:
      POWERSHELL -ExecutionPolicy RemoteSigned -File C:\Temp\RunUpdate.ps1
      Import-Module -Name PSWindowsUpdate
      Get-WUInstall -AcceptAll -IgnoreReboot -NotTitle Bing
      Also removed "unblock file" code from PSWindowsUpdate.psm1
      Literally deleted the line: "Get-ChildItem -Path $PSScriptRoot | Unblock-File" save & exit
      Because of an error executing the Unblock-File command - something about permissions again. Also a Windows 7 only error.
  • New (tiny) Features
    1 Posts | Last post April 17, 2014
    • Hi
      Can you add some extra switches to some of the scripts. In particular I would like to be able to automatically "AcceptAll" in the following modules:
      Currently they don't respond to the "AcceptAll" command and although I can see the script in Get-WUInstall I'm not knowledgeable enough implement this code into the other modules myself.
  • Reliability of WindowsUpdate
    2 Posts | Last post April 16, 2014
    • First of all your module is wonderful 
      I also want in my reporting whether installed windows update is successful or not.
      I read something about reliablity in wmi but could you merge the same in this module. 
    • I think what you're asking is answered just down the page. See the post from Rosco_CA.
  • Date patch was released
    1 Posts | Last post April 15, 2014
    • Your module is a great help.
      I may have missed it but is there a way to get the date a patch was released?
  • Windows Update History
    1 Posts | Last post April 15, 2014
    • Recently i am getting out put in history file like 
      KB                  : KB2267602
      ComputerName        : DDDDDDDDDDDD
      Operation           : 1
      ResultCode          : 2
      HResult             : 0
      Date                : 4/15/2014 5:36:23 AM
      UpdateIdentity      : System.__ComObject
      Title               : Definition Update for Windows Defender - KB2267602 (Definition 1.169.2635.0)
      Description         : Install this update to revise the definition files that are used to detect viruses, spyware, and 
                            other potentially unwanted software. Once you have installed this item, it cannot be removed.
      UnmappedResultCode  : 0
      ClientApplicationID : 
      ServerSelection     : 2
      ServiceID           : 
      UninstallationSteps : System.__ComObject
      UninstallationNotes : 
      SupportUrl          :
      Categories          : System.__ComObject
      Earlier this was coming in a single line.
      DDDDDDD 09-04-2014 10:49:12 KB915597  Definition Update for Windows Def...
      Please guide me why these changes are coming.
      Many thanks in advanced
  • Reboot after installation
    1 Posts | Last post April 08, 2014
    • Hi,
      Recently I have found that there are 3 updates that do not automatically install using the script. They require a "Update and Restart" for them to be installed.
      Is there anyway to resolve this?
11 - 20 of 116 Items