Write Event to Windows Event Log using PowerShell

 

Creating an EventLog entry using PowerShell is shown below:

Write-EventLog -LogName 'Application' -Source 'MyEventSource' -EventID 1000 -EntryType Warning -Message "This is a test of writing to the Event Log using PowerShell."

 

Note: The Event Source needs to be created before writing entries to the Event Log. (See this post for further info: Create Event Source with PowerShell)

 

 

Published by

Henrik Damgaard

Hi I’m Henrik and I write this blog based on useful topics I find interesting – mostly covering some of my technical interests : System Center Operations Manager (SCOM), BizTalk, Windows Server, PowerShell, SQL server, Internet Information Services, PHP and .NET I am currently holding a position as System Administrator with focus on Microsoft server products.

Leave a Reply

Your email address will not be published.

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