May 19 2009

Creating an Event Source via a Reg File

Category: .geekAmit Bahree @ 8:55 pm

If you ever tried to write to the event log, without an event source for that application created you will get an exception saying something along the lines of that you do not have permissions to create the event source.

If an event source does not exist, it is automatically created. The creation of the event source is a privileged operation and requires elevated privileges (a.k.a admin privileges) which of course might not always be possible if running a web application.

The easiest way to create this event source is via a reg file. An example is below (credit goes to my colleague Dominic to provide me the original sample).

Note: you need all the lines below including the “Windows Registry Editor Version 5.00”.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\YOUR-APPLICATION-NAME-GOES-HERE]

"EventMessageFile"=hex(2):43,00,3a,00,5c,00,57,00,49,00,4e,00,44,00,4f,00,57,\

  00,53,00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,2e,00,\

  4e,00,45,00,54,00,5c,00,46,00,72,00,61,00,6d,00,65,00,77,00,6f,00,72,00,6b,\

  00,5c,00,76,00,32,00,2e,00,30,00,2e,00,35,00,30,00,37,00,32,00,37,00,5c,00,\

  45,00,76,00,65,00,6e,00,74,00,4c,00,6f,00,67,00,4d,00,65,00,73,00,73,00,61,\

  00,67,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,00,00

Share
Similar posts to check out:
  • June 17, 2011 -- Kinect SDK (0)
    Microsoft recently release the Kinect SDK which allows you to implement a Natural User Interface and program against it! There is a lot of interest  around including claims on how Robotics will change to how you can integrate a light sensor. You can use Visual Studio (C++, C# and VB.NET supported) and get quite interesting results. Here are a series of links below which will help you get started. Download and install the Kinect SDK Download and install Quickstart Samples and Slide...
  • May 15, 2011 -- Tips on Buying a UPS? (0)
    After moving to Bangalore, it turns out that I would need to get one or more UPS's for the machines at home. The place we will be moving to in a few weeks does have power backup, but if/when there is a power cut it takes a few minutes for the generators to kick in and is not instantaneous as I was thinking. I have never bought a UPS until now and don't have any experience with it - what are the things that I need to consider? I will have the following equipment running which will need to be pow...
  • March 2, 2011 -- Upgrading through every version of Windows (0)
    Upgrading through *all* versions of Windows from v1 thru to Win7....

Tags:

Leave a Reply

*

Get Adobe Flash playerPlugin by wpburn.com wordpress themes