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 ...
Get Windows PowerShell™ Scripting Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.