Use PowerShell to Create a New Event Log

Use PowerShell to easily write to the event log.

John Savill

October 21, 2014

1 Min Read
PowerShell command prompt

Q: How can I create a new event log source in PowerShell?

A: If you want a new event log source available, you can use PowerShell to easily add one. For example, the following code adds a source named TestSource to the Application event log.

New-EventLog -LogName Application -Source TestSource

To actually write a log, you could use:

Write-EventLog -LogName Application -EventId 1234 -Source TestSource -Message "Test write"

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like