Hi all,
I am using LogParser to get query the files/directories on my drives.
I am executing the below code to query my 'C' Drive.
string pathToScan = @"C:\*.*";
string tempPath = @"C:\Log.txt";
string queryString = @"SELECT PATH, SIZE, LASTWRITETIME, ATTRIBUTES, FILEVERSION, COMPANYNAME,PRODUCTNAME,PRODUCTVERSION FROM " + pathToScan + @" TO '" + tempPath + "'";
COMFileSystemInputContextClassClass inputContext = new COMFileSystemInputContextClassClass();
COMTSVOutputContextClassClass outputContext = new COMTSVOutputContextClassClass();
LogQueryClassClass logQuery = new LogQueryClassClass();
logQuery.maxParseErrors = -2;
bool success = logQuery.ExecuteBatch(queryString, inputContext, outputContext);
The results returned by the LogParser will be logged to C:\Log.txt.
Most of the times the output returned is fine.
But in some scenarios, I am getting output of which some are invalid.For example, I installed Virtual PC 2007.exe and uninstalled it. Now when I executed the above query, I am getting a wrong file/folder name which is not present on my C drive. If I do the above steps(install/uninstall), i am consistently getting the wrong output.
The output returned is something like this
Path Size LastWriteTime Attributes FileVersion CompanyName ProductName ProductVersion
C:\Win SDPM insx 1.01 micr
C:\Wi SDPM 1.01
However, on my drive I do not have any file/folder with these names(C:\Win, C:\Wi)
Since I had installed/uninstalled the application, my guess is the Windows' directory has been modified and hence LogParser is returning the said output. This is just a guess though.
I am stuck on this. Any help is appreciated. Is this a known issue/bug with LogParser?
Thanks