I created an event log creator and it works perfect locally. When trying to create an event log remotely it gives me this message:
If the event originated on another computer, the display information had to be saved with the event.
And it adds it to the event log. My current method involves making registry changes on the remote servers. I read online that you can perform an event log remotely using a web service? I am completely lost in creating a web service as I have never made one before, can someone point me in the right direction. I'm also trying to avoid making registry changes on remote servers because they are in a production environment.
My current code:
else if (RemoteText.Text != "")
{
int EventID = Convert.ToInt32(EventIdText.Text);
string myLogName = "";
if (!EventLog.SourceExists(SourceText.Text))
{
//Create source.
EventLog.CreateEventSource(SourceText.Text, myLogName, RemoteText.Text);
Console.WriteLine("Creating EventSource");
}
else
{
// Get the EventLog associated if the source exists.
myLogName = EventLog.LogNameFromSourceName(SourceText.Text, RemoteText.Text);
EventLog myEventLog1 = new EventLog(myLogName, RemoteText.Text);
myEventLog1.Source = myLogName;
// Write an entry into log.
myEventLog1.WriteEntry("This is for your information",
EventLogEntryType.Error, EventID);
}
MessageBox.Show("Event Creation was SUCCESSFUL");
My goal is to remove the generic message on remote computer and avoid making registry changes on remote computer.
Creating an event source does indeed need write access priviliege on the
HKLM\System\CurrentControlSet\eventlog
key.Try
EventSourceCreationData
, you may be missing the message file.If you have administrator access on the remote machine and that said servers do not have remote registry turned off, you could use
WMI
to make registry permission changes and try your approach again.