Powershell远程查询Server 2003的事件日志

时间:2014-01-17 14:56:14

标签: powershell powershell-v2.0 windows-server-2003 event-log

有没有办法通过Powershell远程查询2003服务器上的事件。 Get-eventlog没有-credential切换,get-winevent在Server 2003上无效。

我甚至试过impersonation module。它适用于get-serviceget-processget-counter等命令,但不适用于get-wmiobjectget-eventlog。我错过了什么。

2 个答案:

答案 0 :(得分:2)

你可能正在寻找这个:

Get-WmiObject Win32_NTLogEvent -ComputerName $compName -Credential $cred
Win32_NTLogEvent Get-WmiObject

gm结果(是的,生产可能需要一段时间):

enter image description here

您可以使用过滤(即将-filter "(TimeWritten>'$BeginDate')"添加到gwmi命令),不要忘记在此之前分配$BeginDate变量。见这些:

答案 1 :(得分:2)

在Invoke-Command脚本块中包装Get-EventLog命令。

相关问题