GET-IT: TEAMS DAY | 1-Day Free Virtual Conference all about Teams. Here on Petri.com - 8/12/20 GET-IT: TEAMS DAY - 8/12/20

Help Modifying Script To Retrieve Last Windows Update Date and Time From Computers.

Home Forums Scripting Windows Script Host Help Modifying Script To Retrieve Last Windows Update Date and Time From Computers.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    Shazam
    Member
    #161841

    Hi Everyone,

    I got this VBS code from this link below.

    http://community.spiceworks.com/how_to/show/3632-how-to-create-a-script-set-that-will-query-windows-systems-for-last-windows-update-date-and-time

    Can this script be modify to output the results to a CSV or Text file?

    Currently the results shows in a dialog box.

    Thanks!

    ‘Script pulls last Windows update info from registry of all computers specified in computers text file and echos on screen

    On Error Resume Next

    Set objGetComputerList = CreateObject(“Scripting.FileSystemObject”)
    Set fsoReadComputerList = objGetComputerList.OpenTextFile(“computers.txt”, 1, TristateFalse)
    aryServers = Split(fsoReadComputerList.ReadAll, vbCrLf)
    fsoReadComputerList.Close

    For Each strComputer In aryServers

    Const HKEY_LOCAL_COMPUTER = &H80000002

    strKeyPath = “SOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdateAuto UpdateResultsInstall”
    strEntryName = “LastSuccessTime”
    Set objReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\” & _
    strComputer & “rootdefault:StdRegProv”)
    objReg.GetStringValue HKEY_LOCAL_COMPUTER, strKeyPath, strEntryName, strValue
    Wscript.Echo(strComputer & ” ” & strValue)

    Next[/CODE][CODE]’Script pulls last Windows update info from registry of all computers specified in computers text file and echos on screen

    On Error Resume Next

    Set objGetComputerList = CreateObject(“Scripting.FileSystemObject”)
    Set fsoReadComputerList = objGetComputerList.OpenTextFile(“computers.txt”, 1, TristateFalse)
    aryServers = Split(fsoReadComputerList.ReadAll, vbCrLf)
    fsoReadComputerList.Close

    For Each strComputer In aryServers

    Const HKEY_LOCAL_COMPUTER = &H80000002

    strKeyPath = “SOFTWAREMicrosoftWindowsCurrentVersionWindowsUpdateAuto UpdateResultsInstall”
    strEntryName = “LastSuccessTime”
    Set objReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\” & _
    strComputer & “rootdefault:StdRegProv”)
    objReg.GetStringValue HKEY_LOCAL_COMPUTER, strKeyPath, strEntryName, strValue
    Wscript.Echo(strComputer & ” ” & strValue)

    Next[/CODE]

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.