Writing Your Own Event Log Entries

by Aug 4, 2010

If you have registered a new event log source, such as "PowerShellScripts" as described in the previous tip, you can now write your own Events:

Write-EventLog -LogName Application -Source PowerShellScripts -EntryType Warning -EventId 12345 -Message 'This is my message'

Your scripts can now log successes and errors just like any other professional software.

Twitter This Tip! ReTweet this Tip!