How can I write an event log to a remote PC.

Posted on 2010-01-07
Last Modified: 2012-05-08
I am trying to add event logging to a client/server app.  I would like all the clients to be able to write events to a remote machine so an admin will have them all in one place.  

I have this working to create a new log and branch in the Event Viewer on the remote machine, "GLENN".  
      Dim s As New EventSourceCreationData("AppName", "AppLogName")
      s.MachineName = "GLENN"

But when I execute this there is no way to specify the Machine Name and so the entry appears in the local machine log.  
      EventLog.WriteEntry("AppName", Message, EventLogEntryType.Information, 1234)

Thanks for your help,
Question by:GlennHolden
    LVL 4

    Accepted Solution


     Dim logger As EventLog = New EventLog("Application", "VirtualDev01", "MyApplication")

    will write helloworld in the application log on virtualdev01 under the application source of MyApplication
    LVL 4

    Expert Comment

    Dim logger As EventLog = New EventLog(LogName, LogMachineName, SourceName)
    LVL 41

    Assisted Solution

    In addition to the correct info above, you may also have to manually create the "event source" on the remote PC first.  It's also possible that you'd need to change the permission for this source.

    Author Closing Comment

    Thank you both.  The syntax is what I was looking for.  I appreciate the security issues though.  

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now