List last windows update install date / time

list the last install date and time for windows updates on servers

 
 
 
 
 
4.2 Star
(12)
Add to favorites
Windows Update
9/2/2009
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Export To CSV?
    3 Posts | Last post December 02, 2015
    • This is a great script!  However, I need to output the results to a .CSV file (I need the information for a lot of servers), instead of just to the screen.  I've spent close to 4 hours trying to figure out how to do this and haven't had any luck.  Anyone have ideas on how to do this?
    • If you get the txt is possible to delimiter on ; easy!!
      
    • If you execute this script on Powershell 3.0 (Windows Server 2012 I think), you can use this code instead of 
      Write-Host $Server "Last time updates were installed was: " $KeyValue 
      
      New-Object -TypeName PSCustomObject -Property @{
      		Servername = $Server
      		LastUpdate = $KeyValue
      	} | Export-Csv -Path C:\updates.csv -Delimiter ";" -NoTypeInformation -Append
  • Just autoupdates?
    2 Posts | Last post December 02, 2015
    • Does this script just return when the last autoupdate was installed?  What about when windows update is run manually?
    • We run updates manually and the script works for our environment. You can check this if you have a look at the registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\Results\Install\LastSuccessTime. The value in there should be the same as seen in Control Panel - Windows Update (although the time zone might be different).
  • Problemd with Windows 2008
    2 Posts | Last post December 02, 2015
    • I am attempting to use this script on windows 2008 servers, but it does not like the format of much of the code:
      
      At C:\wu.ps1:13 char:71
      +         $RemoteBase = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey <<<< (
      $keytype,$Server)
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : DotNetMethodException
      
      You cannot call a method on a null-valued expression.
      At C:\wu.ps1:14 char:41
      +         $regKey = $RemoteBase.OpenSubKey <<<< ($key)
          + CategoryInfo          : InvalidOperation: (OpenSubKey:String) [], Runtim
         eException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      
      You cannot call a method on a null-valued expression.
      At C:\wu.ps1:15 char:37
      +         $KeyValue = $regkey.GetValue <<<< ("LastSuccessTime")
          + CategoryInfo          : InvalidOperation: (GetValue:String) [], RuntimeE
         xception
          + FullyQualifiedErrorId : InvokeMethodOnNull
      
    • My answer is probably too late, but if anyone else is wondering about this: The error message "You cannot call on a null-valued expression" means that the registry key does not exist or is empty. This is the case when updates have never been installed before.
  • Explanation of error message
    2 Posts | Last post December 02, 2015
    • I like this script it is very useful. Thank you. Two items, first it does not return values for all the servers in the OU and is inconsistent in which servers are returned, ideas?
      Second I get an error message, sometimes two when I run it. I see the line and character in the error but have no idea what to do with them as it works for around two thirds of the systems.
      
      Exception calling "OpenRemoteBaseKey" with "2" argument(s): "The network path was not found.
      "
      At X:\System Tools\Working List Servers last OS update.ps1:23 char:9
      +         $RemoteBase = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($keytype, ...
      +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : IOException
      
      Any help is appreciated. 
    • My answer is probably too late, but if anyone else is wondering about this: It says The network path was not found. This means the host is not available. To catch this exception, you can add this code:
      
      if (test-connection $Server -quiet) {
      $key = ...
      }
  • Its not working on Windows 2003
    1 Posts | Last post February 10, 2014
    • Its not working on Windows 2003.
      
      For me only works in Widnows 2008  and Windows 2012. 
      
  • question
    2 Posts | Last post March 15, 2010
    • HI,
      I find useful the script you've posted/. I wonder however where to get the snap-pin referred in the script:
      
      quest.activeroles.admanagement
      
      Some help in this direction would help newbies like me.
      Regards
      
    • Hi,
      
      you'll find this one at http://www.quest.com/powershell 
      
      
      Ralf M. Schnell (http://blogs.technet.com/ralfschnell)