5 Replies Latest reply on Nov 26, 2014 11:18 AM by Joe Haley

    How to get the installed date for the patches

      Share This:

      Hi,

      Is there anyway to get the installed date for all the patches. We need to have a report consists of

      Machine Name, OS Type, Installed Patch ID, Patch Repository ID, Installed Date

       

      can anyone help me plz.@

        • 1. Re: How to get the installed date for the patches


          we are using Oracle database which is hosted on UNIX server

          • 2. Re: How to get the installed date for the patches

            Unless the patches are installed via Marimba it is not possible to get the install date. Unless you use a custom channel to collect the data from the endpoint's registry or WMI Database.

            • 3. Re: How to get the installed date for the patches

              Hi Gregory,

              i don't have much knowledge on scripting/queries. can you please tell me how to do that custom channel to get the data from the endpoint's registry or WMI Database.

              • 4. Re: Re: How to get the installed date for the patches

                It does require some programming/scripting abilities to create custom solutions. Following is the steps on a high level:

                 

                > Identify the source where the information you are looking for is accurate.

                > Find a way to get that information (WMI Query / Registry Query) and create a script like VB or Java to get the information

                > Output to the invtree as per the instructions in the attached guide

                > Create the required tables to store the information in invdb

                > Run the custom scanner extension on a target

                 

                Validate that it does in fact pick up the right information and store it in the DB as expected. Then you can deploy to all machines to collect the information.

                 

                If you are sure that the information in the registry is correct then you can use the Registry Scanner utility that comes in-built with the scanner service.

                • 5. Re: Re: How to get the installed date for the patches
                  Joe Haley

                  The code below can be used in a Type 2 NSH script.  I'm currently using to just pull back the most recent successful date and updating a property called LAST_PATCH_DATE so it would have to be modified.  The command "wmic qfe get HotFixID,InstalledOn  /format:csv" can also be used, but I was getting dates in hexadecimal format on Windows 2008 servers with it. 

                   

                  #!/bin/nsh

                   

                  FULL_PATH_THIS_FILE="$0"

                  THIS_FILE=`basename "${FULL_PATH_THIS_FILE}"`

                   

                  # Find location of embedded script

                  LENGTH_OF_MAIN_SCRIPT=`cat "$FULL_PATH_THIS_FILE" | grep -n '### END OF MAIN SCRIPT ###' | grep -v grep | cut -d ':' -f1`

                   

                  # Increment this by one to move past the line identifier

                  LENGTH_OF_MAIN_SCRIPT=`expr $LENGTH_OF_MAIN_SCRIPT + 1`

                   

                  # Extract Script

                  tail +$LENGTH_OF_MAIN_SCRIPT "$FULL_PATH_THIS_FILE" > "/tmp/$$"

                   

                  # Loop thru target servers

                  for target in ${@}

                  do

                   

                  # Copy embedded script to target server

                  cp /tmp/$$ //${target}/tmp/$$.vbs

                  # Return the last successful patch date by executing the vbscript commands below

                  #nexec -i -l ${target} cmd /c "cscript c:\\tmp\\$$.vbs"

                  last_patch_date_results=`nexec -i -l ${target} cmd /c "cscript //Nologo c:/tmp/$$.vbs"`

                   

                  # Update the BSA Server property

                  blcli_execute Server setPropertyValueByName "$target" LAST_PATCH_DATE "$last_patch_date_results"

                   

                  # Remove the temp script file from the target server

                  rm -f //${target}/tmp/$$.vbs

                  done

                   

                  # Remove temp script file from app server

                  rm -f /tmp/$$

                  exit 0

                   

                  ### END OF MAIN SCRIPT ###

                  On Error Resume Next

                   

                  strComputer = "."

                  Set objSession = CreateObject("Microsoft.Update.Session")

                  Set objSearcher = objSession.CreateUpdateSearcher

                  intHistoryCount = objSearcher.GetTotalHistoryCount

                  'Set colHistory = objSearcher.QueryHistory(1, 1)

                  Set colHistory = objSearcher.QueryHistory(1, intHistoryCount)

                  ' Loop thru all Windows Updates and exit when find most recent successful update

                  For Each objEntry in colHistory

                      If objEntry.ResultCode = "2" Then

                         'Wscript.Echo objEntry.ResultCode  

                         Wscript.Echo objEntry.Date

                         WScript.Quit

                      End If

                  Next