This script will create an event in an existing event log or a new event log.
This can be useful to keep track of what happens in your script either locally or using monitoring tools like SCOM. You can also use it to test if custom event monitoring you’ve configured is working as expected.
Or run a task in response to a given event as explained here.