|
代码如下:
strComputer = "."
strNamespace = "\root\cimv2"
strClass = "Win32_NTLogEvent"
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & strNamespace)
Set colSWbemObjectSet = objSWbemServices.ExecQuery("SELECT * FROM Win32_NTLogEvent WHERE EventCode = '0' ", "WQL", wbemFlagReturnImmediately +wbemFlagForwardOnly)
For each SWbemobject in colSWbemObjectSet
wscript.echo SWbemobject.data
Next
这段代码首先通过查询返回事件日志ID为0的所有事件,然后读取这些这些事件的时间属性(wscript.echo SWbemobject.data),即事件的Data属性,Data属性在WMI中的type为array of uint8。而运行这段代码后无法得到预期的结果,全部显示的都是NULL。请问各位高手,这里面涉及的格式转化问题该如何解决,原理又是什么了? |
|