Jump to content

Write to Windows Event Log from application log file


kkurniawan
 Share

Recommended Posts

Hi there,

I have an application that writes an error to log file and I write the error to windows event log manually. I wonder if I can use AutoIt script to specify the location of the error file in the script and the script reads the error file content and write to windows event log automatically.

This is what I have so far:

Set WshShell = WScript.CreateObject("WScript.Shell")

strCommand = "eventcreate /T Error /ID 100 /L CP-Link /D " & _

Chr(34) & "Cannot connect to unit." & Chr(34)

WshShell.Run strcommand

Any help/suggestion is highly appreciated.

Thanks,

Senukung

Link to comment
Share on other sites

With AutoIt you can use:

$SystemEvent='eventcreate /T Error /ID 999 /L SYSTEM /SO AutoItScript /D "A Event Created with AutoIt "'

Run(@ComSpec & " /c " & $SystemEvent, "", @SW_HIDE)

Be careful with the OS Language

Entry Application is in German ANWENDUNG

tested with windows XP

good luck for your script :lmao:

Edited by Micha1405
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...