O'Reilly logo

Windows PowerShell™ Scripting Guide by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing to Event Logs

The ability to write to event logs using Windows PowerShell is an extremely useful capability. Both the Windows Vista and the Windows Server 2008 event logs provide for the centralized management of events that occur on the system. With the .NET Framework System.Diagnostics.EventLog class, you can write to any of the classic event logs: System, Application, and Security. But you can also create your own event logs or write to other event logs as well.

Creating a Source

Before you can write to an event log, you must first create a source. The source is used by the event log to identify where the event originated. This provides a very useful property to use in queries if you are writing to a shared source event log. Once the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required