开发者

How can I use python to read windows eventlog from a remote machine?

I'm working on retrieving the Windows eventlog from a remote machine using Python.

I tried the following code:

import win32evtlog 

server = 'aRemoteMachineHostName' 
logtype = 'System' 
hand = win32evtlog.OpenEventLog(server,logtype)
total = win32evtlog.GetNumberOfEventLogRecords(hand)

and I get an access denied error.

Then I tried use win32security.Logon to do the authentication before I access the ev开发者_开发百科entlog. But I find in the win32security.Logon document, it says the API only supports local logon.

So, I'm a little bit stuck here. I wonder whether Python can do a remote Windows logon? Any tips or hints will be helpful.

Thanks.


might be easier to use snmp


As long as the user who is executing the script has the credentials to connect and read the event log, this ActiveState Recipe works for me. I've used it in a few different situations.

ActiveState WinEvtLogViewer

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜