View Single Post
  #2 (permalink)  
Old December 30th, 2004, 08:58 AM
mmcdonal mmcdonal is offline
Friend of Wrox
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts


   You can't do this from VBScript per se since any event you generate in vbscript will show WSH as the source, like this:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.LogEvent 0, "MyFile.vbs by mmcdonal"

This creates an event in the event log with the event number of 0 with the text as the description and the source "WSH".

You can call CMD.EXE from your script and use the "Eventcreate" command, however. Here is some syntax...

C:\>eventcreate /l Application /t Information /so Me /id 100 /d Test

This code creates an event log in the Application log, with the Type "Information", the Source "Me", an Event Number of 100 (must be 1 - 1000) and the Description "Test"

Go to the command prompt and type eventcreate /? for all the available switches. I can't remember how to call CMD right now, so I didn't put that part in. Can someone else help with that?

I hope this helps.

Reply With Quote