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.

 
 
 
 
 
(181)
137,371 times
Add to favorites
Windows Update
12/18/2014
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • -autoreboot often does not seem to reboot a node on its own
    4 Posts | Last post April 23, 2015
    • Hi: 
      
      I am currently using this module to updates several machines. I notice that (even with "-Force" added  in Get-WUInstall.ps1   in latest version) some nodes do not reboot on their own and wait for a user confirmation. This keeps them from finishing their update cycle and requires manual intervention. 
      
      Is there a way to get reliable reboots upon reaching proper stage in Get-WUInstall? I am using
      
      get-wuinstall -serviceid ....... -acceptall -autoreboot -verbose.
      
      Does anyone else experience this failure to reboot automatically?
      
      Thanks.
      
      Gautam
      
    • Did you ever find an answer to your question? I am having the same problem. Thank you.
    • I have -Verbose -AcceptAll -AutoReboot at the end of my command in that exact order and have not seen the issue you are seeing.  Just in case switch order and capitalization matter.
    • Sorry - after looking closer I see I actually did put an extra command in my script to reboot after the installs and I even commented that it was added because it didn't always reboot like it should.
  • The term 'Unblock-File' is not recognized as the name of a cmdlet, function
    4 Posts | Last post April 23, 2015
    • hi, i tried to make this work but i get an error....
      i created a script: 
      >"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -Command "Import-Module PSWindowsUpdate; Get-WUInstall -AcceptAll | Out-File C:\PSWindowsUpdate.log"
      
      when i run this i get the error: 
      The term 'Unblock-File' is not recognized 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 C:\Users\Administrator\Documents\WindowsPowerShell\Modules\PSWindowsUpdate\PSWindowsUpdate.psm1:1 char:49+ Get-ChildItem -Path $PSScriptRoot | Unblock-File <<<<+ CategoryInfo          : ObjectNotFound: (Unblock-File:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException
      
      does anyone knows what this means? 
      
    • I had the same problem on Windows 7. Initially I tried to unblock each of the files in the PSWindowsUpdate Module folder but this did not resolve issue. I upgraded PowerShell to the latest version and this fixed issue for me.
    • Unblock-file was a built-in cmdlet first introduced with Powershell 3.0.
      
       I see this error on Windows 2003/2008 servers that are still running Powershell 2.0. So far, I can ignore this error if I have Unblocked the downloaded module zip file before I push to other computers. 
      
      Below is the get-help for the command.
      The Unblock-File cmdlet lets you open files that were downloaded from the Internet. It unblocks Windows PowerShell script files that were downloaded from the Internet so you can run
      them, even when the Windows PowerShell execution policy is RemoteSigned. By default, these files are blocked to protect the computer from untrusted files.
      
      Before using the Unblock-File cmdlet, review the file and its source and verify that it is safe to open.
      
      Internally, the Unblock-File cmdlet removes the Zone.Identifier alternate data stream, which has a value of "3" to indicate that it was downloaded from the Internet.
      
      For more information about Windows PowerShell execution policies, see about_Execution_Policies (http://go.microsoft.com/fwlink/?LinkID=135170).
      
      This cmdlet is introduced in Windows PowerShell 3.0.
      
    • It is buried in this Q&A but you can also resolve this by removing the line "Get-ChildItem -Path $PSScriptRoot | Unblock-File" from the beginning of the PSWindowsUpdate.psm1 file.  Then it works without updating powershell.
  • On the PSWindowsUpdate.psm1, not using global wildcard?
    2 Posts | Last post April 17, 2015
    • Hi,
      Great scripts, thank you for the tools.
      
      I was developing an in-house module to use on a Core server.  I noticed when importing the PSWindowsUpdate module, that it would pull our in-house functions as well.
      
      I found the issue that the PSWindowsUpdate.psm1 file is using a very broad wildcard. i.e.:
      Get-ChildItem -Path $PSScriptRoot\*.ps1 | Foreach-Object{ . $_.FullName }
      
      I would like to suggest it be changed to:
      Get-ChildItem -Path $PSScriptRoot\Add-WU*.ps1 | Foreach-Object{ . $_.FullName }
      Get-ChildItem -Path $PSScriptRoot\Get-WU*.ps1 | Foreach-Object{ . $_.FullName }
      Get-ChildItem -Path $PSScriptRoot\Hide-WU*.ps1 | Foreach-Object{ . $_.FullName }
      Get-ChildItem -Path $PSScriptRoot\Update-WU*.ps1 | Foreach-Object{ . $_.FullName }
      
      This way, it only pulls in the scripts specific to 'WU'.
      
      8D...ave
    • (answering my own question)
      Nevermind, figured out you need to place the files into a sub-folder with the module name.  Missed that part.  *pout/smile*
      
  • Updated package
    3 Posts | Last post April 07, 2015
    • Hello, I see you have a change log up to updates version 1.5.1, but I am only able to download version 1.4.5.  Do I merge the update of version 1.4.5 with the PSWindowsUpdate folder?  
      Or maybe the main download is at version 1.5.1?  Please advise.
      
      Thank you
    • The main download button near the top of the page links to the 1.5.1 release.
    • If you have the PSWindowsUpdate module installed, Update-WUModule cmdlet will by default download the latest version from the internet. YOu can then use your local copy to distribute to other systems in your network. 
      
      
      #Specify the local module copy to deploy 
      "Phi1-bob","phi2-bill","phi7-sally"|Update-WUModule -LocalPSWUSource "C:\Window\system32\WindowsPowerShell\V1.0\Modules\PSWindowsUpdate" -Verbose
      
  • Updates Are Hanging Up Due To Windows Update Popup
    2 Posts | Last post April 06, 2015
    • PSWindowsUpdate is stopping when the notification to restart your computer popup shows up on the workstation. See popup here http://www.cfbangor.com/windowsupdate.png
      
      Is there a way to prevent this from happening? I assume there might be a switch I need to use.
    • Its not clear to me what you mean by PSWindowsUpdate is stopping? 
      
      Are you using Get-WUReBootStatus and the remote computer is not accepting the Yes to reboot? 
      
      Try
      Get-WURebootStatus -Autoreboot -verbose -ComputerName machine1
      This always bounces my servers if they are ready at that prompt.
      If you need something else, use the built in Shutdown /I command. 
      Chadwick Cooper
      
      
  • COM Exception when using get-wulist to query a remote machine
    8 Posts | Last post April 02, 2015
    • This module is superb and works well locally. But I get this COM Exception when I try to use get-wulist to query a system remotely. I tested this against a few machines and they all throw the same exception. Could this be due to a permission on the COM object?
      
      Exception calling "CreateInstance" with "1" argument(s): "Retrieving the COM class factory for remote component with CLSID {4CB43D7F-7EEE-4906-8698-60DA1C38F2FE} from machine 
      xxxxxxx failed due to the following error: 800706ba xxxxxxx."
      At C:\Users\xxxxx\Documents\WindowsPowerShell\Modules\PSWindowsUpdate\Get-WUList.ps1:254 char:6
      +                     $objSession =  [activator]::CreateInstance([type]::GetTypeFromProgID("Micro ...
      +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : COMException
    • Hi,
      Check firewall settings.
    • Thank you! Yes, it was a rule on the Windows Firewall. This module is awesome!
    • What did you change on the Firewall, please?
    • Ran into this also ... googling and wiresharking leads me to the conclusion that initial contact with the remote client happens on TCP 135, but then redirects to a High-Rang port that is dynamically selected. As of Win 2008, this is 49152 - 65535.
      
      So it seems we have to either open up that range, or just disable firewall on the client.(?)
    • In windows 2012 R2, there are two firewall rules that should already exist, that should be enabled - under Inbound rules, Select Com+ Network Access (DCOM-In) and COM+ Remote Administration (DCOM-In), and enable these rules. 
      
    • Dear Michal,
      thank you for publishing this module!
      
      Dear SunnySNair,
      it is great that you found out "... Yes, it was a rule on the Windows Firewall"
      But which one?
      I'm encountering the same Problem and it would make sense, if I don't have to Experiment, if you already have the answer!
      
      Dear Chadwick Cooper,
      it was not (enough) to enable the two inbound rules!
      But: Thanks a lot!
      
      best regards,
      Klaus
      
      
      
      
    • As stated by Chadwick Cooper, I enabled these two inbound rules:
      
      Com+ Network Access (DCOM-In)
      COM+ Remote Administration (DCOM-In)
      
      This alone did not solve my problem. Opening up the port range provided by Martin Bird for TCP *did* solve the problem:
      
      49152-65535
      
      So for me, it took enabling those two rules *and* opening the port range for TCP for things to work. Martin said that's the range, but how exactly could that have been determined. And I can't find through Google a definitive answer, so going with this solution for now.
      
  • Need To use cmdlet to install only one kb from a lot
    1 Posts | Last post April 02, 2015
    • Hi,
      I need to use cmdlet but not module.
      i need to install one KB without restart with cmdlet on 100 computers.
      the Kb is already downloded i need just to install it from 10KB.
      I use an appliance to run script on a lot aof computers.
      
      Thank you in advance
  • Import not working
    3 Posts | Last post March 30, 2015
    • PS C:\Users\Administrator> Get-Module -ListAvailable
      
      ModuleType Name                      ExportedCommands
      ---------- ----                      ----------------
      Manifest   ADRMS                     {}
      Manifest   AppLocker                 {}
      Manifest   BestPractices             {}
      Manifest   BitsTransfer              {}
      Manifest   PSDiagnostics             {Enable-PSTrace, Enable-WSManTrace, Start-Trace, Disable-PSWSManCombined...
      Manifest   PSWindowsUpdate           {}
      Manifest   RemoteDesktopServices     {}
      Manifest   ServerManager             {}
      Manifest   TroubleshootingPack       {}
      Manifest   WebAdministration         {}
    • PS C:\Users\Administrator> Import-Module PSWindowsUpdate
      Import-Module : There were errors in loading the format data file:
      Microsoft.PowerShell, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\PSWindowsUpdate.Format.ps1xml
      : File skipped because it was already present from "Microsoft.PowerShell".
      Microsoft.PowerShell, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\PSWindowsUpdate.Format.ps1xml
      : File skipped because it was already present from "Microsoft.PowerShell".
      Microsoft.PowerShell, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\PSWindowsUpdate.Format.ps1xml
      : File skipped because it was already present from "Microsoft.PowerShell".
      Microsoft.PowerShell, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\PSWindowsUpdate.Format.ps1xml
      : File skipped because it was already present from "Microsoft.PowerShell".
      Microsoft.PowerShell, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\PSWindowsUpdate.Format.ps1xml
      : File skipped because it was already present from "Microsoft.PowerShell".
      Microsoft.PowerShell, C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSWindowsUpdate\PSWindowsUpdate.Format.ps1xml
      : File skipped because it was already present from "Microsoft.PowerShell".
      At line:1 char:14
      + Import-Module <<<<  PSWindowsUpdate
          + CategoryInfo 
    • Hi,
      
      I am trying to import module on 2 different servers (W2k8R2) without success
      
      Importing another module (ex PSDiagnostics is ok)
      
      Do we need a specific powershell version ?
  • Change logs output
    2 Posts | Last post March 23, 2015
    • Hi,
      I want to change log file output, instead of X column with step number, I need a date.
      I've tryed to change get-wuinstall 
      From:
      $log = New-Object PSObject -Property @{
      Title = $Update.Title
      KB = $UpdatesExtraDataCollection[$Update.Identity.UpdateID].KB
      Size = $UpdatesExtraDataCollection[$Update.Identity.UpdateID].Size
      Status = $Status
      X = 2
      }				
      To:
      $date = get-date
      $log = New-Object PSObject -Property @{
      Title = $Update.Title
      KB = $UpdatesExtraDataCollection[$Update.Identity.UpdateID].KB
      Size = $UpdatesExtraDataCollection[$Update.Identity.UpdateID].Size
      Status = $Status
      Date = $date
      }					
      
      But it does not work, still gives me X column the in the logs. 
      
    • Found what was wrong, naed to edeit PSWindowsUpdate.Format.ps1xml file also.
      Logs output looks the way I need now.
  • Microsoft Update
    4 Posts | Last post March 10, 2015
    • Has something changed with Microsoft Update? I'm only getting the "Failed" status when I try to install updates for Windows 8.1 in audit mode.
    • I haven't seen official word from MS, but I first noticed it at the end of October, 2014.
      
      You can confirm it yourself by going to the WindowsUpdate.log, where you should see this:
      
      1     Windows OOBE is still in progress. AU deferring detection
      2     WARNING: BeginDetection failed, hr:0x8024a008
      3     All AU searches complete.
      4     # WARNING: Failed to find updates with error code 8024a008
      5     AU setting next detection timeout to 2014-10-22 12:44:24
      6     OOBE is in progress, so cannot perform Accelerated Install
      
      WU silently fails and tries again, for hours. I found nothing in the Event Viewer alerting me to the situation.
      
      It appears to be the same on Server 2012 R2 and Windows 8.1 when they're in Audit mode.
    • I have no idea what changed, but this morning it works again.
    • You must have left audit mode.
      
      I just now ran Windows update on a 2012R2 vm still in audit and I got the expected "1     Windows OOBE is still in progress. AU deferring detection" in WindowsUpdate.log and no updates are downloading.
      
      Do you have a WSUS server? That might be a difference, since I don't have one.
11 - 20 of 151 Items