monitoring Windows EventLog Events using wmic
Posted: Fri Feb 05, 2016 2:00 pm
I'm trying to use wmic to query WMI on a host using WQL. I can verify that some information on general queries is returned, like this:
command:
wmic -U user%password --namespace root/cimv2 //hostname "Select * From Win32_NTEventlogFile"
output:
CLASS: Win32_NTEventlogFile
AccessMask|Archive|Caption|Compressed|CompressionMethod|CreationClassName|CreationDate|CSCreationClassName|CSName|Description|Drive|EightDotThreeFileName|Encrypted|EncryptionMethod|Extension|FileName|FileSize|FileType|FSCreationClassName|FSName|Hidden|InstallDate|InUseCount|LastAccessed|LastModified|LogfileName|Manufacturer|MaxFileSize|Name|NumberOfRecords|OverwriteOutDated|OverWritePolicy|Path|Readable|Sources|Status|System|Version|Writeable
0|True|c:\windows\system32\winevt\logs\internet explorer.evtx|False|(null)|Win32_NTEventlogFile|20131011011959.476859-420|Win32_ComputerSystem|CSUPP01|c:\windows\system32\winevt\logs\internet explorer.evtx|c:|c:\windows\system32\winevt\logs\intern~1.evt|False|(null)|evtx|Internet Explorer|69632|evtx File|Win32_FileSystem|NTFS|False|20131011011959.476859-420|0|20131011011959.476859-420|20131011012106.978178-420|Internet Explorer|(null)|1052672|C:\Windows\System32\Winevt\Logs\Internet Explorer.evtx|0|0|WhenNeeded|\windows\system32\winevt\logs\|True|(Internet Explorer)|OK|False|(null)|True
and information on objects that the connecting account is forbidden to access return code indicating as such.
The problem I experience is that when I try to query a very specific result, wmic doesn't return any output. Here is the command I'm currently testing with:
wmic -U user%password --namespace root/cimv2 //hostname "Select * From Win32_NTLogEvent where RecordNumber = 18166"
Can anyone explain what is causing the absolute lack of output here? Is it related to the WMI class I'm querying? I tested the query in wbemtest on the Windows host and it returns a value just fine.
Does anyone here have any experience using wmic to monitor Windows Event Log Events?
command:
wmic -U user%password --namespace root/cimv2 //hostname "Select * From Win32_NTEventlogFile"
output:
CLASS: Win32_NTEventlogFile
AccessMask|Archive|Caption|Compressed|CompressionMethod|CreationClassName|CreationDate|CSCreationClassName|CSName|Description|Drive|EightDotThreeFileName|Encrypted|EncryptionMethod|Extension|FileName|FileSize|FileType|FSCreationClassName|FSName|Hidden|InstallDate|InUseCount|LastAccessed|LastModified|LogfileName|Manufacturer|MaxFileSize|Name|NumberOfRecords|OverwriteOutDated|OverWritePolicy|Path|Readable|Sources|Status|System|Version|Writeable
0|True|c:\windows\system32\winevt\logs\internet explorer.evtx|False|(null)|Win32_NTEventlogFile|20131011011959.476859-420|Win32_ComputerSystem|CSUPP01|c:\windows\system32\winevt\logs\internet explorer.evtx|c:|c:\windows\system32\winevt\logs\intern~1.evt|False|(null)|evtx|Internet Explorer|69632|evtx File|Win32_FileSystem|NTFS|False|20131011011959.476859-420|0|20131011011959.476859-420|20131011012106.978178-420|Internet Explorer|(null)|1052672|C:\Windows\System32\Winevt\Logs\Internet Explorer.evtx|0|0|WhenNeeded|\windows\system32\winevt\logs\|True|(Internet Explorer)|OK|False|(null)|True
and information on objects that the connecting account is forbidden to access return code indicating as such.
The problem I experience is that when I try to query a very specific result, wmic doesn't return any output. Here is the command I'm currently testing with:
wmic -U user%password --namespace root/cimv2 //hostname "Select * From Win32_NTLogEvent where RecordNumber = 18166"
Can anyone explain what is causing the absolute lack of output here? Is it related to the WMI class I'm querying? I tested the query in wbemtest on the Windows host and it returns a value just fine.
Does anyone here have any experience using wmic to monitor Windows Event Log Events?