Powershell -Create new Event Source and Event and Scheduled Tasks

Rather than writing to log files etc for scheduled tasks using powershell, it can be handy to write an event to the event log.

Of course you may not want to confuse things by using the same event ID or Event source.
So why not create your won event source for the Application log.

This way if you have a monitoring system such as SCOM or any event log monitoring system, you can integrate your custom events into the monitoring

Based on How to Use PowerShell to Write to Event Logs
As admin create a new event source

New-EventLog –LogName Application –Source “BritV8 Script”

Then as a normal user
Write-EventLog –LogName Application –Source “BritV8 Script” –EntryType Information –EventID 1 –Message “This is a test message. ”

You can also get a scheduled task to trigger on the event being written see:

Trigger a PowerShell Script from a Windows Event

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.