2017-06-29 104 views

回答

0

你的意思是事件源? PowerShell的將是 則New-EventLog命令發現這裏提供的更詳細的編輯後

MSDM New-eventLog

你想要什麼的基本原理是查詢日誌文件並將找到的行寫入事件日誌。這就好比做如下:

#Get the content of the error log, gets the top 10 lines ONLY!! 
$GetLog = Get-Content -Path D:\Errorlog.txt -totalcount 10 

#Now take the data found and write it to the event log under the source and log below 
Write-EventLog -LogName "Application" -Source "My Application" -Eventid 1001 
-EntryType Error -Message "$Getlog" -Category 1 
+0

我需要顯示在事件日誌窗口中的應用 myapplication.log --->應用程序事件日誌窗口 –

+0

,我收到你現在的日誌。我認爲這是可能的....承擔我 –

+0

謝謝理查德,但我怎麼能夠實時做到這一點 –