Raise custom Windows Events using vbscript.

Posted on 2014-08-18
Last Modified: 2015-02-22
I am looking for a way I can raise Windows Events using vbscript. I want to raise an event...

Type: Information
Date: ...
Time: ...
Source: {Want to be able to dynamically assign this}
Category: None
Event: {Want to use my own event ID here e.g. 2342}
User: N/A
Computer: {Whatever it happens to be}

I have found this code online:

Set shell = CreateObject("WScript.Shell")
shell.LogEvent 4, "Your Message Here"

But this does not provide the level of customisation I want as above...

Any ideas?
Question by:Blowfelt82
    1 Comment
    LVL 65

    Accepted Solution

    Hi, the syntax of the Raise event is
    shell.Raise(lngNumber, strSource, strDescription)

    so you can set the number, source, and description.  The other thing you can do is use the command line EventCreate utility.

    strSource = "MyApp Source"
    strType = "INFORMATION"
    strID = "201"
    strLog = "Application"
    strDescription = "This application has started"
    strCommand = "cmd /c eventcreate /so """ & strSource & """ /T """ & strType & """ /ID " & strID & " /L """ & strLog & """ /D """ & strDescription & """"
    Set objShell = CreateObject("WScript.Shell")
    objShell.Run strCommand, 0, True

    Open in new window



    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now