Hello,

I am trying to write a script for backing up and clearing event logs on
our Windows 2003 servers, using Python 2.5 and Tim Golden's WMI module.
While testing with the Application log on a local Windows XP machine I
seem to get stuck on the parameters to WMI.

The following code:

import wmi
c = wmi.WMI(privileges=["Backup"])
logfiles = c.ExecQuery("SELECT * FROM Win32_NTEventLogFile WHERE
  LogFileName='Application'")

for lf in logfiles:
    lf.BackupEventLog("c:\\temp\\Applog.evt")

gives the following error message:

Traceback (most recent call last):
   File "<interactive input>", line 2, in <module>
   File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line
491, in __getattr__
     raise pythoncom.com_error, details
com_error: (-2147352567, 'Exception occurred.', (0, 'SWbemObjectEx',
'Invalid parameter ', None, 0, -2147217400), None)

If I use the full wmi moniker, ie

c =
wmi.WMI(moniker="winmgmts:{impersonationLevel=impersonate,(Backup)}\\\\ketjap\\root\\cimv2")

I get the same error.

Have I missed somthing regarding impersonation and privileges?

Thank's in advance

Marten Hedman


-- 
------------------------------------------------------------------------
Mårten Hedman                      phone: +358-(0)2-333 8037
Systems Manager                    fax:   +358-(0)2-333 8000
Turku Centre for Biotechnology     [EMAIL PROTECTED]
Turku, Finland                     http://www.btk.fi/~marten


_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to