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


  • Not working on Server 2016
    2 Posts | Last post Fri 2:10 PM
    • This script works fine on Server 2012 but not in Server 2016. Is there an updated script that I can get hold of. Or please let me know if there is anything else out there. 
      Thank you.
    • I've been using this without issue in Windows 10 and Server 2016. Can you provide more details?
  • Version 2.0.0.4: How do you install updates remotely?
    1 Posts | Last post June 27, 2018
    • I'm using 2.0.0.4.  What is the replacement for Invoke-WuInstall?  I use it extensively for remote updating and the modules will only run locally.
  • Unable to Run Windows Update On Remote Computers
    3 Posts | Last post June 27, 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
    • on the line where you are creating sessions you need to change it to this
      $s = Get-Content "C:\WindowsUpdate-Prod\Prod\MT-Servers.txt"
      The -Computername is expecting a string and you are passing a session object, so it blows up.
  • Import-Module PSWindowsUpdate not working
    1 Posts | Last post June 20, 2018
    • has there been a change to anything that would break the "Import-Module PSWindowsUpdate" installation ?
  • Integrating PSWindowsUpdate with DSC
    1 Posts | Last post June 08, 2018
    • Crossposted from powershellgallery.com/packages/PSWindowsUpdate where there is more information. 
      
      I created a custom Desired State Configuration resource module that utilizes PSWindowsUpdate version 1.4.x and it has worked well for over a year now. I wanted to take advantage of the new features in version 2.0.0.4, but I am running into a strange error that I hope someone can help me with. 
      
      Here is my DSC code: https://pastebin.com/8nxQBmzb
      
      As you can see from the code, the Test phase runs Get-WUList and will return false if updates are found. The Set phase runs Get-WUInstall -Install –AcceptAll –IgnoreReboot -Verbose.
      The error occurs during the Set phase. In my example log below, the module finds 2 updates in the pre search criteria and 2 updates in the post search criteria. The module is able to accept both updates, but only downloads and installs one of the updates, which is expected. After the one update gets installed (it really does get installed), this error shows:
      
      A command that prompts the user failed because the host program or the command type does not support user interaction. 
      Try a host program that supports user interaction, such as the Windows PowerShell Console or Windows PowerShell ISE, 
      and remove prompt-related commands from command types that do not support user interaction, such as Windows PowerShell 
      workflows.
          + CategoryInfo          : NotImplemented: (:) [], CimException
          + FullyQualifiedErrorId : HostFunctionNotImplemented,PSWindowsUpdate.GetWindowsUpdate
          + PSComputerName        : MYSERVERNAME.domain.com
      
      The little bit of research I've done suggests that the Get-WUInstall command is prompting for user input or maybe write-host is called somewhere in the code after the update is installed. Since this version of the module is a compiled DLL, I can't check the code to troubleshoot it, hence why I'm asking here. I'm hoping the original author or one of the maintainers can help me troubleshoot this issue
  • Date format for ScheduledReboot
    2 Posts | Last post June 07, 2018
    •  I've tried to use Get-WindowsUpdate -AcceptAll -Install -ScheduleReboot '06.07.2018 03:00:00' with the date format as displayed in the help and also another way. '06.07.2018 03:00:00' and '06/07/2018 03:00:00'
      
      Then, when I use Get-WURebootStatus to view the schedule after, the output does not show scheduled nor does the GUI.
      
      
      
       What date format should I be using ? Can someone confirm success and show the format like ....  DD/MM/YYYY HH:MM:SS
    • Format 'MM/DD/YYYY HH:mm:ss' did actually work, but is not displayed in the output of Get-WURebootStatus so this appears to be a display issue or the scheduled reboot date function of that command is not working.
  • PS Module take a long time
    1 Posts | Last post June 07, 2018
    • I have several Windows 10 1703 desktop station. Some are physical and some virtualized. My virutalized systems has a big problem. All PSWindowsUpdate commands take a long time for execution. For example Get-WUSettings take 2 minutes and 45 seconds. A retry does not minimize the execution time.
      If i execute this on a physical Windows 10 then it take one second. Nearly the same on a virtualized Windows 7. What could be the problem?
  • Get-WUServiceManager - WSUS not listed as default
    5 Posts | Last post June 04, 2018
    • OS is Server 2016 w/GUI. For some reason our wsus server is not listed as the default.  I know my client is checking in to our wsus server when I use the GUI to check for updates because I can see the connection on our wsus server.  I have added pointed the client to our wsus server using gpedit.msc.
      
      Here is the output of Get-WUServiceManager (couldnt copy and paste so leaving ID as XXX:
      ServiceID  IsManaged  IsDefault  Name
      ---------  ---------  ---------  ----
      XXX        True       False      Windows Server Update Service
      XXX        False      True       Windows Update
      
      My question is, how can I change it so that our wsus server is the default so that Get-WUInstall pulls updates from our wsus server?
      
      Thanks
    • I have a question posted on stack exchange.  Would you mind taking a look?  THank you so much. 
      https://stackoverflow.com/questions/46457625/using-get-wuinstall-on-remote-machines-access-denied
      
    • Disregard my last reply to you.  That was accidental and not related to your question. Sorry.
    • I am struggling with the same problem. My WSUS is set through GP, but not listed as default so get-windowsupdate shows 0 results.
    • I fixed this by Enabling the policy for "Do not allow update deferral policies to cause scans against Windows Update"
  • hide-wuupdate missing?
    2 Posts | Last post June 04, 2018
    • Hello,
      
      I've installed the most recent version of the module on Windows 10, and while all other cmdlets work fine (e.g. get-wulist), hide-wuupdate seems to be missing:
      
      hide-wuupdate : The term 'hide-wuupdate' is not recognized as the name of a cmdlet
      
      Was is removed?
      Thanks,
      Tomasz
    • Hmm it looks like it was renamed to hide-windowsupdate?
  • 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? 
1 - 10 of 313 Items