View Single Post
  #7 (permalink)  
Old January 12th, 2011, 02:46 PM
thedude thedude is offline
Registered User
 
Join Date: Jan 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This article helped to steer me on the write path so I wanted to let everyone know how I went about doing this. I am searching a text file for errors and if I find one, I wanted to write a custom event to the event viewer with a custom source and custom ID number.

Code:
'## write the custom event to event viewer - chr34 is inserting quote within quote
            CmdLine = "eventcreate /l Application /t ERROR /so ERS /id 100 /d " & chr(34) & ErrorMessage[this is another variable i defined earlier] &_
                      ". Please contact ERS technical to resolve" & chr(34)

      
            objWSHShell.Run CmdLine
This creates an error event in the event viewer with a source of ERS and an event ID of 100 with my custom error message. mmcdonal's post above is very helpful. Hope this helps

Last edited by thedude; January 12th, 2011 at 02:48 PM..
Reply With Quote