how to get elements of a com object (wmi log events)
News123
news1234 at free.fr
Thu Apr 15 20:39:24 EDT 2010
Just having a short question:
I found a code snippet, that fetches windows event logs via a wmi query.
import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_NTLogEvent")
for i,itm in enumerate(colItems):
entry =( itm.TimeGenerated,itm.TimeWritten,
itm.Category,itm.CategoryString,itm.ComputerName,
itm.Data,itm.EventCode,itm.EventIdentifier,
itm.EventType,itm.InsertionStrings,itm.LogFile,
itm.Message,itm.RecordNumber,
itm.SourceName,itm.Type,itm.User)
print entry
Asumming I would not have no documentation, I would be too lazy to
lookup or to type all this code.
Would there be any way to query the list of members
( TimeGenerated , TimeWritten, . . . ) of variable itm?
thanks upfront
N
More information about the Python-list
mailing list