So, I am attempting to write to the Windows Event Log using Write-EventLog. I've compiled a CategoryMessageFile .dll and have registered it in the registry.
My script writes to the event log for the most part, but the problem is that the event doesn't display the category name; it displays the category message id enumerated in the dll.
New-EventLog -LogName Application -Source 'test1' -CategoryResourceFile 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\test.dll' Write-EventLog -LogName Application -Source 'test1' -EntryType Information -EventId 1 -Message "$($DataSet.Tables[0].Rows[$i][6])" -Category 1
I know the mapping is correct because when I run
Get-EventLog -LogName Application -Newest 3 | Format-List
The correct Category name shows up under Category for the events I had just written to the log.
Here is what my mc file looked like.
;// Header
;// Categories
MessageIdTypedef=WORD
MessageId=0x1
Language=English
ETLUncategorizedError
.
MessageId=0x2
Language=English
ETLThresholdExceeded
.
MessageId=0x3
Language=English
ETLMalformattedFile
.
MessageId=0x4
Language=English
ETLWebInvocationFailure
.
So, how do I get the name to display instead of the number in the event log?