写事件日志不写入应用程序日志(注册优先源后)

问题描述:

我尝试写入事件日志“应用程序”。我用了ScriptingGuy-Tutorial。如博客中所述,我使用以下命令在“以管理员身份运行”中注册源“ScS”--Powershell: New-EventLog -logname Application -source "ScS"写事件日志不写入应用程序日志(注册优先源后)

我没有收到错误消息或任何其他反馈。在注册表中我可以看到源路径

HKLM\System\CurrentControlSet\Services\EventLog\Application\ScS 

enter image description here

在那之后,我试着写一个事件:

write-eventlog -logname Application -Source "ScS" -EntryType Information -EventId 01 -Message "Test" 

我没有收到一个错误。但它不写这个事件。我没有看到它在eventvwr也没有在shell中,使用get-eventlog -LogName Application -Source "ScS"

我使用Win 8.1 Pro(德语)与Powershell 4.0。希望你能告诉我我的错误...

你失去了第一个调用中的日志名称是你想创建的日志名称“Application”是现有日志的事实。

下面是一个例子(PowerShell的V2有它自己的小命令):

# List of logs 
Get-EventLog -list 

# Creating your own log 
New-EventLog -LogName "SlxScripting" -Source "MaSource" 

# List of logs 
Get-EventLog -list 

# Writting in your own log 
Write-EventLog -LogName "SlxScripting" -EventId 12 ` 
       -Message "Mon Message" 
       -Source "MaSource" -EntryType Warning 

# Reading (consuming) in your own log 
Get-EventLog -LogName "SlxScripting" 

# Suppressing your log (if needed) 
Remove-EventLog -LogName "SlxScripting"