Raymond.CC Blog
  • Home
  • Forum
  • Giveaway
  • X-Ray 2.0
  • Contact
  • About
  • I’m Feeling Lucky
Search the site...
You are here: Home » Windows » Create a Custom Event in the Windows Event Viewer

Create a Custom Event in the Windows Event Viewer

Updated by Raymond - 10 months ago - Windows
17
  • Like
  • +1
  • Tweet
  • Printer Friendly and PDF
Using batch to execute eventcreate

When a lot of more experienced users are troubleshootinga a PC, one of the the first things that will come to mind, is to have a study of the Windows Event Viewer. In the Event Viewer, we are able to track a number of the errors or information events that have happened on the system. From the event logs, at least we know which application is causing the issue, and the time and date the error occurred. With this information, it is possible to narrow down the problem, and then find out the root cause to resolve the issue. Since all of us know the purpose of the event logs, did you ever think of making good use of the event log to create a hidden trail for applications? For example, you do not want somebody to launch a web browser on your system without you knowing about it, as you have a lot of ‘private’ bookmarks stored inside…

In order to create a custom event in the event log, you will need to know little bit of scripting. In Windows XP, Vista and 7, an event can be created in the event log by using an internal command called ‘eventcreate‘. You are able to store the event in either ‘Application‘ log or ‘System‘ log, with an event ID between 1 to 1,000. There seems to be conflicting information whether the limit is 1,000 or 65,535 to create a valid event ID, so it’s advisable to stick to <1,000 to be safe. Let’s assume we want to track the launching of Firefox web browser and record this specific event in the ‘Application‘ log inside the event log with event ID 123.

1. Open up Notepad or your favorite text editor.

2. Type in the command as below:

cd “%SYSTEMDRIVE%\Program Files\Mozilla Firefox\”
firefox http://raymond.cc
eventcreate /T Information /ID 123 /L Application /SO MozillaFirefox /D “Firefox launched”

Using batch to execute eventcreate

3. Save the text file as “Firefox.bat”

4. Double click the batch file and run it

Just to explain what the script does, the first and second lines are pretty obvious and make the Firefox folder, or any folder you choose, the current directory. Then it runs Firefox with a website to open, Raymond.cc in this case.

Here’s what the eventcreate commands do:

/T This is the type of event to create which can be one of Error, Warning, Information, Successaudit, and Failureaudit.

/ID As described earlier, it’s best to use a value between 1 and 1,000.

/L Lets you choose which log the event will be created in, Application or System.

/SO The source name that is creating the event, best for it to be the programs name or similar.

/D The description of the event, make sure to enclose a phrase in quotes.

After you execute the batch file, Firefox will launch, and then you can visit the Event Viewer which is located in Control Panel -> Administrative Tools in your system. You will notice that an event is created under ‘Application’ log. There should now be an information event which the source name as MozillaFirefox, and most importantly, it recorded the date and the time when firefox is executed.

Application log in event viewer

A simple but useful trick. After you have created this executable batch, you can always hide it away, and then just change your desktop shortcut target to point to the batch file, instead of pointing the original executable file. With this setting, you will be able to monitor the application launch. I have found that ‘eventcreate‘ is a very useful command, especially when you dealing with scripting or programming.

Of course, you don’t have to restrict this function to Firefox or a browser and it can be used for just about anything. Simply enter the correct directory, the correct executable name and edit the eventcreate line to suit your needs.

Didn't find what you want? The links below could help:

Right Click Context Menus Added to your DesktopRight Click Context Menus Added to your DesktopUnable to View Pictures in Archive with 7-ZipUnable to View Pictures in Archive with 7-ZipSync Your Bookmarks Across Browsers and SystemsSync Your Bookmarks Across Browsers and SystemsSave Web Pages as Images or PDF Files with Web Page SaverSave Web Pages as Images or PDF Files with Web Page Saver

17 comments on “Create a Custom Event in the Windows Event Viewer”

  1. pyrex666 says:
    2 years ago

    yupz.. this really help.. tnx raymond

    Reply
  2. ihaveapc says:
    2 years ago

    Neat trick, this becomes helpful when creating event alerts for custom applications that are either being tested or for diagnostics purposes.

    Have you found degradation of performance when creating multiple custom events?

    Reply
  3. Juan says:
    2 years ago

    It is great to hear some feedback from you guys, will try to post some scripting stuff in the future. :)

    Reply
  4. Dudo says:
    2 years ago

    Interesting, but for this purpose is better to use windows integrated auditing (and more hidden for end user)

    Reply
  5. Juan says:
    2 years ago

    play8oy – The same method can be apply at Google Chrome. Just change the batch file to run Google Chrome instead of Firefox.

    Reply
  6. Edron says:
    2 years ago

    great tip, thanks!

    Reply
  7. mrdjmo says:
    2 years ago

    great tip , thanx

    Reply
  8. Victor Narvaez S says:
    2 years ago

    Thx Juan, nice trick!

    Reply
  9. Alan says:
    2 years ago

    Excellent tip Juan!! :)

    helps a lot in spying……..:)

    Reply
  10. Sul2005tan says:
    2 years ago

    Thank you juan. I’m happy to learn something new

    Reply
  11. Jim says:
    2 years ago

    Thanks, Juan

    Reply
  12. Neo says:
    2 years ago

    thx for tip juan

    i never saw your post before nor saw u ever in forum

    Reply
  13. Ayush Kumar says:
    2 years ago

    Cool..>!!

    Reply
  14. play8oy says:
    2 years ago

    Thanks for the share Juan, how do you make it work for google chrome?

    Reply
  15. saurav chandra shrestha says:
    2 years ago

    nice one

    Reply
  16. katsumoto says:
    2 years ago

    really a good tip!

    Reply
  17. Mohamed says:
    2 years ago

    good tip
    THANKS…!!!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recently Updated

  • flash bios icon

    5 Tools to Easily Install FreeDOS or MS-DOS onto USB for BIOS Flashing

  • avast icon

    Reset or Remove avast! Authorization Password to Access Settings

  • U3 icon

    How to Customize U3 USB Smart Drive to Become Ultimate Hack Tool

New Articles

  • task manager replacement icon

    Memory Usage Test to See Which is the Lightest Antivirus Software

  • kaspersky antivirus 2013 icon

    Activate Free Kaspersky Anti-Virus 2013 ROG with 1 Year License

  • remote access software

    Top 8 Remote Access Software for Providing Online Support

Popular Posts

  • Top 10 FREE Data Recovery Software

    Top 10 FREE Data Recovery Software

  • How to Hack Into a Windows XP Computer Without Changing Password

    How to Hack Into a Windows XP Computer Without Changing Password

  • 10 Free Software to Mount CD or DVD ISO Image File as Virtual Drives

    10 Free Software to Mount CD or DVD ISO Image File as Virtual Drives

Recommend on Google
Follow @raymond_cc
Subscribe Youtube »
(c) 2013 Raymond.CC Blog
  • Contact
  • Disclaimer
  • Disclosure
  • Privacy Policy
  • Terms of Use
  • Sitemap