Jump to content

Windows Event Logging Error


masonje
 Share

Recommended Posts

I have a small grp of users who are getting script errors with one of my install scripts that writes to the event log. So just to test on one of the issue PCs, I slapped down a quick "hello world" to see what would happen and I got the same error in the same place. Attached is the error screenshot from the original installer and below is my sample code.

$WshShell = ObjCreate("WScript.Shell")
if @error or $WshShell = 0 Then
    MsgBox(266288,"WshShell","Could not create object.")
    Exit
EndIf

$WshShell.LogEvent(4, "Hello World")

Thoughts on why that user's PC is erroring out and most every one else is fine. Looks like something is wrong with there event logging itself.

post-9485-1160661250_thumb.jpg

Link to comment
Share on other sites

Do you have a com error handler in your script?

Example:

$oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler 

; Performing a deliberate failure here (object does not exist)
$oIE = ObjCreate("InternetExplorer.Application")
$oIE.visible = 1
$oIE.bogus 
if @error then Msgbox(0,"","the previous line got an error.")

Exit 


; This is my custom error handler 
Func MyErrFunc() 
   $HexNumber=hex($oMyError.number,8) 
   Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _
                "Number is: " & $HexNumber & @CRLF & _
                "Windescription is: " & $oMyError.windescription ) 

   SetError(1) ; something to check for when this function returns 
Endfunc
Who else would I be?
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...