Sign in to follow this  
Followers 0
iceberg

WSUS status

1 post in this topic

hi all,

i have another code which forces windows update to force start and check for updates.

what i am now planning to do is to capture all the details from the log file onto the following script codes.

unfortunately, it is not working. can someone kindly assist me here?

thanks.

#include <File.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("WSUS", 794, 266, 263, 273)
$Edit1 = GUICtrlCreateEdit("", 16, 8, 761, 209, BitOR($ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL))
GUICtrlSetData(-1, "Windows Server Update Service" & @CRLF)
$Button1 = GUICtrlCreateButton("Hide", 352, 232, 89, 25, BitOR($BS_CENTER, $BS_VCENTER))
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Dim $aChatlog, $TotalLine
    $chatlog = "C:\WINDOWS\SoftwareDistribution\reportingevents.log"
    $TimeStamp = FileGetTime($chatlog, 0, 1)
    If Not _FileReadToArray($chatlog, $aChatlog) Then
        MsgBox(4096, "Error", " Error reading log to Array error: " & @error)
        Exit
    EndIf
    $TotalLine = $aChatlog[0]

    If FileGetTime($chatlog, 0, 1) <> $TimeStamp Then
        $TimeStamp = FileGetTime($chatlog, 0, 1)
        _FileReadToArray($chatlog, $aChatlog)
        If IsArray($aChatlog) Then
            $newLines = ""
            For $i = $TotalLine To $aChatlog[0]
                $newLines &= $aChatlog[$i] & @CRLF
            Next
        EndIf
        $CountLines = _FileCountLines($chatlog)
        $2nd = $CountLines - 1
        $line = FileReadLine($chatlog, $2nd)
        If @error = -1 Then Exit
        $array = StringSplit($line, @TAB)
        ;MsgBox(0, $array[11], $array[12])
        $menutext = GUICtrlRead($Edit1, 1)
        GUICtrlSetData($Edit1, $array[12] & @CRLF, 1)
        ;MsgBox (0,"Changed","New line(s) : " & @CRLF & $newLines)
    EndIf
    Sleep(15000)

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            GUISetState(@SW_HIDE, $Form1)
    EndSwitch
WEnd

mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0