473,320 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

WriteEntry can't write under user account

I would like to write to the EventLog (Application) with following code. But
this works only under admin account. There are no restrictions in the
WriteEntry-documentation.
Can anyone help me?

Thanks in advance!
try
{
EventLog eLog = null;
bool bLäuft = true;
if(!EventLog.SourceExists("XXX")) EventLog.CreateEventSource"XXX", "",".");
eLog = new EventLog();
eLog.Log = "";
eLog.Source = "XXX";
if (bLäuft == true) eLog.WriteEntry("läuft",EventLogEntryType.Informa tion,1);
eLog.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}

Jan 24 '06 #1
3 1347
Hi

The event log class will underlying call the Event log Win32 API.
You can check the document below.
Event Logging Security
http://msdn.microsoft.com/library/de...us/eventlog/ba
se/event_logging_security.asp

Based on my test, I create a new user by default, I did not change any
permission for the user. When we logon to the windows with the user, the
code above will run.
Because when we log onto the Windows, the user is an Interactive user.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 25 '06 #2
Thanks for your quick answer.

The document explains a lot. But I still have a problem:
If I run the code under user account AND the Source XXX isn' t already
registered to the EventLog, I receive the error "Requested registry access is
not allowed" for the EventLog.SourceExists part.

Can I only register the Source as an admin??? Is there no other way?

Thanks in advanse!

""Peter Huang" [MSFT]" wrote:
Hi

The event log class will underlying call the Event log Win32 API.
You can check the document below.
Event Logging Security
http://msdn.microsoft.com/library/de...us/eventlog/ba
se/event_logging_security.asp

Based on my test, I create a new user by default, I did not change any
permission for the user. When we logon to the windows with the user, the
code above will run.
Because when we log onto the Windows, the user is an Interactive user.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 25 '06 #3
Hi

To add an event source, we need to access to the registry key.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog\Application]
http://msdn.microsoft.com/library/de...us/eventlog/ba
se/adding_a_source_to_the_registry.asp

But by default, the users group did not have permisson to write to the
registry key for security concern.
I think it would better for the admin to create the event source and the
user just write to the event log.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John Lee | last post by:
Hi, we have been trying so many days and could not figure it out - please help!!! in windows 2003, we created an application pool and assigned a domain account as its identity - we also...
2
by: TJO | last post by:
I am creating an EventLog and attempting to write to it using the following code. The problem is when I inspect the log there in no entry? Can anyone see what I am doing wrong here? if...
2
by: Russell Thomas | last post by:
I've been working with the My.Application.Log.WriteEntry method in VB.net 2005 and when it writes a log is stores the log file in the application data folder under the systems user account. I have...
3
by: Dachshund Digital | last post by:
Has any one figured out how to override the WriteEntry or show change the actual output? I am sorry, but putting the DATE/TIME PROCESS # and Thread # information AFTER the 'Message' text just...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.