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
(329)
649,536 times
Add to favorites
Windows Update
4/4/2017
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Unable to Run Windows Update On Remote Computers
    2 Posts | Last post May 16, 2018
    • I am actually trying to install windows update on remote computers using below powershell command but it gives an error mentioned below
      Step 1: Trying to Create New Session for list of computers
      
      $s = New-PSSession -ComputerName (Get-Content "C:\WindowsUpdate-Prod\Prod\MT-Servers.txt")) -Credential mtc-maersk\sgs035adm -ThrottleLimit 50
      
      Using Invoke-WUInstall, trying to install windows update on remote computers, when run like " invoke-wuinstall -computername "RemoteComputerName" it works but it gives error if use the below method
      
      Invoke-WUInstall -ComputerName $s -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll -AutoReboot  | Out-File C:PSWindowsUpdate.log  } -Confirm:$false -Verbose
      
      Error: when i try to create new session from list computers ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide anargument that is not null or empty, and then try the command again.At line:1 char:34+ ... omputerName (Get-Content C:\WindowsUpdate-Prod\Prod\MT-Servers.txt) - ...+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    + CategoryInfo          : InvalidData: (:) [New-PSSession], ParameterBindingValidationException    + FullyQualifiedErrorId : ParameterArgumentValidationError,
      ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      Error: when i try to run Invoke-Command -ComputerName (Get-Content "Location\server.txt"
      PS C:\Windows\system32> Invoke-WUInstall -ComputerName (Get-Content "C:\WindowsUpdate-Prod\Prod\MT-Servers.txt") -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll -AutoReboot  | Out-File C:\WindowsUpdate\PSWindowsUpdate.log  } -Confirm:$false -VerboseVERBOSE: Populating RepositorySourceLocation property for module PSWindowsUpdate.VERBOSE: Loading m
      +++++++++
    • I tried the below as well
      
      $RemoteComputers = Get-Content "C:\WindowsUpdate-Prod\Prod\MT-Servers.txt"
      
      If (Test-Connection -ComputerName $RemoteComputers -Quiet)
      {
           Invoke-Command -ComputerName $RemoteComputers -ScriptBlock {Get-ChildItem “C:\WindowsUpdate\Test.ps1”}
      }
      but no luck!! Winrm is listening and i am able to access the server if i try with just invoke-wuinstall -computername <compname>.
      please assit
  • How can I use the PS command Get-WindowsUpdate to obtain the Microsoft security bulletin numbers for each update?
    1 Posts | Last post May 09, 2018
    • How can I use the PS command Get-WindowsUpdate to obtain the Microsoft security bulletin numbers for each update? 
  • It is completly disconnected from Settings / WU
    1 Posts | Last post April 19, 2018
    • I can do 
      C:\Windows\System32\USOClient.exe StartScan
      updates (due to WU GPO settings) are downloaded (Install button is active) buy this PS Module still downloads its own copy & while installing it does not register the running ststus in Settings /WU (as one would get with C:\Windows\System32\USOClient.exe StartInstall )
      Could that be integrated?
      
  • Updates not installing.
    2 Posts | Last post April 19, 2018
    • Hi,
      
      I am not sure what I am missing but I am following the steps using the link below and am getting a list of updates being returned but nothing being installed. This is on Windows Server 2016.
      
      https://www.urtech.ca/2017/07/solved-simple-powershell-script-download-install-windows-updates-reboot-necessary/
      
      Thanks.
      Akshay
    • Use this instead:
      Install-WindowsUpdate –AcceptAll –AutoReboot
  • A way to wuauclt /reportnow?
    1 Posts | Last post April 11, 2018
    • Is there an equivalent way to force the client to report status back to WSUS?  Something equivalent to the old wuauclt /reportnow?
  • Possible to filter by date?
    1 Posts | Last post April 10, 2018
    • Is there a way to filter updates by date, before download and installation?
      
      I've been trying to install updates released more than X days ago, but don't see any built in filter for date.  If it's possible to parse a list, and feed the updated list back into Get-WUInstall, that would be ideal.
      
      Thank.  
  • How to report on available updates?
    2 Posts | Last post March 14, 2018
    • I am trying to find a way to get a list of available updates, and sending them to an admin address, but I am struggling to make it give me a useable output.
      For example:
      $WUList = Get-WUList
      Send-MailMessage -to $ToAddress -from $FromAddress -Subject $Subject -smtpserver $SMTPServer -Credential $SMTPCreds -Body $WUList
      Gives me this error:
      Send-MailMessage : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Body'. Specified method is not supported.
      
      Send-MailMessage -to $ToAddress -from $FromAddress -Subject $Subject -smtpserver $SMTPServer -Credential $SMTPCreds -Body ($WUList | Out-String)
      Almost works, and I get this in my email body:
      ComputerName Status KB          Size Title                                                                                                                                                                                                                                               
      ------------ ------ --          ---- -----                                                                                                                                                                                                                                               
      DESKTOP-L... D----- KB4088776 182 GB 2018-03 Cumulative Update for Windows 10 Version 1709 for x64-based Systems (KB4088776)
      
      But that is all, and not particularly well formatted.
      
      $MessageContent = "
      These updates will be installed:
      $WUList
      "
      Send-MailMessage -to $ToAddress -from $FromAddress -Subject $Subject -smtpserver $SMTPServer -Credential $SMTPCreds -Body $MessageContent
      Is close, but the message body contains:
      Updates are available.
      These updates will be installed:
      System.__ComObject System.__ComObject
      
      
      So, in conclusion, has anyone found a way of formatting the output of Get-WUList so it can be used?
      I have tried playing around with changing the Type, and converting from System.Object, but without any luck.
    • you have to convert the $wulist into html and a string and send the email as html. Try this:
      
      $html = $WUList |select ComputerName, Status, KB, Size, Title | ConvertTo-Html | Out-String
      Send-MailMessage -to $ToAddress -from $FromAddress -Subject $Subject -smtpserver $SMTPServer -Credential $SMTPCreds -BodyAsHtml $WUList
      
  • Github?
    1 Posts | Last post March 14, 2018
    • Hi, is this project hosted on Github (or any other platform?)
      -> Where can I report bugs?
      -> Where can I find a global documentation? (Like an About_PsWindowsUpdates for example).
      
      Thanks
  • issue with Invoke-WUInstall
    1 Posts | Last post February 27, 2018
    • I followed the example to update a remote server but I got an error as below, could anyone suggest?
      
      ERRROR INFO
      "
      Could not compare "1.5.2.6" to "1.5.2.6 1.5.2.6". Error: "Cannot convert the "System.Object[]" value of type "System.Object[]" to type 
      "System.Version"."
      At C:\windows\system32\windowspowershell\v1.0\Modules\PSWindowsUpdate\Invoke-WUInstall.ps1:103 char:9
      +                     if($ModuleTest -eq $null -or $ModuleTest.Version -lt $PSWUModule.Version)
      +                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : ComparisonFailure
      
      "
      
      THE EXAMPLE
      "
      PS C:\Windows\system32> get-help Invoke-WUInstall -Examples
      NAME
          Invoke-WUInstall
      SYNOPSIS
          Invoke Get-WUInstall remotely.
          
          -------------------------- EXAMPLE 1 --------------------------
          
          PS C:\>$Script = {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll -AutoReboot | Out-File C:\PSWindowsUpdate.log}
          PS C:\> Invoke-WUInstall -ComputerName pc1.contoso.com -Script $Script
          ...
          PS C:\> Get-Content \\pc1.contoso.com\c$\PSWindowsUpdate.log
      "
      
  • Is this the same as the PSWindowsUpdate module on PSGallery?
    1 Posts | Last post February 18, 2018
    • That module lists the same author, but is v2.0 as a "binary module". Trying to run Show-WindowsUpdate returns this error...
      
      The term 'Get-WindowsUpdate' 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.
          + CategoryInfo          : ObjectNotFound: (Get-WindowsUpdate:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
      
      
      
1 - 10 of 306 Items