New event log nowhere to be found after creating in PowerShell

Posted by Mega Matt on Server Fault See other posts from Server Fault or by Mega Matt
Published on 2012-12-13T20:00:29Z Indexed on 2012/12/17 11:04 UTC
Read the original article Hit count: 472

Through PowerShell, I am attempting to create a new event log and write a test entry to it, but it is not showing up the Event Viewer. This is the command I'm using to create a new event log:

new-eventlog -logname TestLog -source TestLog

And to write a new event to it:

write-eventlog TestLog -source TestLog -eventid 12345 -message "Test message"

After running the first command, there is no "TestLog" log in the event viewer anywhere, and I would expect it to show up in the Applications and Services Logs section. After running the second command, same result. However, I am seeing a registry key for the log at HKLM\SYSTEM\services\eventlog\TestLog. Just not seeing anything in the event viewer.

So, 2 questions: When should I be seeing the event log? After it gets created or after I write the first event to it? And, more importantly, why am I not seeing it at all?

I'm using Windows Server 2008R2, and am logged in and running the PS as an administrator.

Thanks.

© Server Fault or respective owner

Related posts about powershell

Related posts about event-log