Saving remote event log

Pieter Claerhout PClaerhout at CREO.BE
Tue May 23 06:30:47 EDT 2000


Hello all,

I wrote a script that saves the Windows event log from a remote
machine, and it looks like this:

<code>
#!/usr/bin/env python

import os
import sys
import win32api
import win32evtlog

if len(sys.argv) == 1:
    computerName = win32api.GetComputerName()
else:
    computerName = sys.argv[1]

evtLogSys = win32evtlog.OpenEventLog(computerName, 'system')
win32evtlog.BackupEventLog(evtLogSys, 'system.evt')
win32evtlog.CloseEventLog(evtLogSys)

evtLogSec = win32evtlog.OpenEventLog(computerName, 'security')
win32evtlog.BackupEventLog(evtLogSec, 'security.evt')
win32evtlog.CloseEventLog(evtLogSec)
                           
evtLogApp = win32evtlog.OpenEventLog(computerName, 'application')
win32evtlog.BackupEventLog(evtLogApp, 'application.evt')
win32evtlog.CloseEventLog(evtLogApp)
</code>

Local, it works fine, but when I try this on a remote machine, I get the 
following error message:

<error>
Traceback (innermost last):
  File "evtlog.py", line 14, in ?
    win32evtlog.BackupEventLog(evtLogSys, 'system.evt')
pywintypes.api_error: (0, 'BackupEventLogW', 'No error message is available')
</error>

I think it has something to do with security, but I have however a drive mapped
using administrative rights to that machine. Someone has any suggestions?

Kind regards,


Pieter




More information about the Python-list mailing list