[Mono-list] Mono and EventLog
Gert Driesen
gert.driesen at telenet.be
Thu Feb 15 11:43:36 EST 2007
Hi Zsolt,
At this moment we do not support reading from or writing events to a remote
computer.
Gert
From: mono-list-bounces at lists.ximian.com
[mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Zsolt Molnar
Sent: donderdag 15 februari 2007 8:21
To: mono-list at lists.ximian.com
Subject: [Mono-list] Mono and EventLog
Hi All,
Could anybody give advice how to manage the EvenLogs of Windows computers
and servers from Mono under Linux ??
Here is a sample code which works fine under Windows but nothing happen when
I run under Linux and I don't get any error message.
Of course I tried the machine name with Windows machine's IP address.
using System;
using System.Text;
using System.Diagnostics;
class Program
{
static void Main()
{
string myRemoteMachine;
string myLogName = "MyLog";
Console.Write("Enter computer on which to create log : ");
myRemoteMachine = Console.ReadLine();
// Check if the source exists.
if (!EventLog.SourceExists("MyTestSource"))
{
//Create source.
EventLog.CreateEventSource("MyTestSource", myLogName,
myRemoteMachine);
Console.WriteLine("Creating EventSource");
}
else
// Get the EventLog associated if the source exists.
myLogName = EventLog.LogNameFromSourceName("MyTestSource",
myRemoteMachine);
EventLog myEventLog1 = new EventLog(myLogName, myRemoteMachine);
myEventLog1.Source = "MyTestSource";
// Write an entry into log.
myEventLog1.WriteEntry("This is for your information",
EventLogEntryType.SuccessAudit,
100);
Console.WriteLine("An EventLog created on computer " +
myEventLog1.MachineName);
Console.Write("Enter remote computer on which to create log :
");
myRemoteMachine = Console.ReadLine();
EventLog myEventLog2 = new EventLog();
myEventLog2.MachineName = myRemoteMachine;
myEventLog2.Source = "MyTestSource";
myEventLog2.Log = myEventLog1.LogDisplayName;
myEventLog2.WriteEntry("This is for your information");
Console.WriteLine("An EventLog created on computer " +
myEventLog2.MachineName);
}
}
Best Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070215/720f8e10/attachment.html
More information about the Mono-list
mailing list