Gets or sets the name of the computer on which to read or write events.
Assembly: System (in System.dll)
If you write to an event log, you must associate a Source with your event log object to connect it to a particular log. It is not necessary to specify the Source property when only reading from a log. You can specify only the Log name and (server computer name).
You need not specify the if you are connecting to a log. If you do not specify the , the local computer (".") is assumed.
A source can only be registered to one log at a time. If the Source property was set for an instance of EventLog, you cannot change the property for that EventLog without changing the value of Source or calling DeleteEventSource first. If you change the property, the EventLog closes all handles and reattaches to the log and source on the new computer.
The value cannot be an empty string. If it is not explicitly set, it defaults to the local computer (".").
The following example reads entries in the event log, "NewEventLog", on a specified computer.
Imports System Imports System.Diagnostics Imports Microsoft.VisualBasic Class MySample Public Shared Sub Main() Dim myNewLog As New EventLog() myNewLog.Log = "NewEventLog" myNewLog.MachineName = "MyServer" Dim entry As EventLogEntry For Each entry In myNewLog.Entries Console.WriteLine((ControlChars.Tab & "Entry: " & entry.Message)) Next entry End Sub ' Main End Class ' MySample