Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET

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

  • 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.

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: