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.
Use PowerShell to easily write to the event log.
October 21, 2014
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"
You May Also Like