Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
1  
Are you refreshing the eventvwr.msc after this? I copied/pasted your commands and it worked as expected. Right-click the "Applications and Services Logs" container and select "Refresh". –  jscott Dec 13 '12 at 20:12
    
Yes, I have refreshed many times. There has to be something I'm missing... –  Mega Matt Dec 13 '12 at 20:15
1  
@MegaMatt - are you running Powershell as an admin when creating the event source? I've had a lot of silent powershell failures without doing so. –  Tim Brigham Dec 13 '12 at 20:22
    
Yes, running as an admin –  Mega Matt Dec 13 '12 at 20:26

1 Answer 1

Terrible reason: I needed to close the Event Viewer and re-open. That's completely insane. Thanks for help.

share|improve this answer
    
Odd, I guess your refresh was misbehaving. :) Glad you resolved this, please be sure to accept your answer when you are able. –  jscott Dec 14 '12 at 0:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.