sublimnl 0 Posted March 19, 2005 Share Posted March 19, 2005 I wrote a script tonight that detects when a VNC session is established, grabs the client IP address and then gets the relevant output from "nbtstat -a <clientIP>" and puts it into a variable. The last portion of the script is to take this information and write it to the Windows Event Log (Event Viewer). I searched around but did not find anything. Does anyone know of a way to do this preferably in AutoIt? If not, are there any 3rd party utils that can be used for this? Thanks! Link to post Share on other sites
CyberSlug 6 Posted March 24, 2005 Share Posted March 24, 2005 (edited) Edit: Windows XP appears to have a built in util EVENTCREATEHere's a workaround, but I'd really like a built-in AutoIt solution:expandcollapse popup#cs ------------------- User-Defined function to write events to 2000/XP event log Information from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthlogevent.asp LIMITATIONS 1) You can only write to the "Applications" log 2) The source will always appear as "WSH" 3) The event ID can only be one of the following: 0 SUCCESS 1 ERROR 2 WARNING 4 INFORMATION 8 AUDIT_SUCCESS 16 AUDIT_FAILURE 4) The category and type will both be "None" #ce ------------------- _LogEvent("This is a sample event messsage!") _LogEvent("This is another message from AutoIt!", 0) Exit Func _LogEvent($message, $ID = 4) ; If $ID is an invalid number, then use 4 as default value If $ID > 16 Or $ID < 0 Or BitAND($ID,-$ID) <> $ID then $ID = 4 ; It might be bad if message contains double quotes, so replace them with single quotes $message = StringReplace($message, '"', "'") Local $tempFile = @TempDir & "\AutoItLogEvent.vbs" Local $handle = FileOpen($tempFile, 2);overwrite FileWriteLine($handle, 'Set WshShell = WScript.CreateObject("WScript.Shell")') FileWriteLine($handle, 'WshShell.LogEvent ' & $ID & ', "' & $message & '"') If $handle <> -1 Then FileClose($handle) RunWait("WScript.exe " & $tempFile) FileDelete($tempFile) EndIf EndFunc Edited March 24, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to post Share on other sites
this-is-me 7 Posted March 24, 2005 Share Posted March 24, 2005 Am I remembering incorrectly, or did Larry also code something like this into Au3Xtra.dll? Who else would I be? Link to post Share on other sites
CyberSlug 6 Posted March 24, 2005 Share Posted March 24, 2005 I completely forgot about looking in au3xtra.dll I figured since nobody had posted that there there wasn't a pure AutoIt (or AutoIt-dll) solution... Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to post Share on other sites
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now