WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

LogParser

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Query XML Files for MD5 Hash

 Keywords: Query XML MD5 Hash DataGrid LogParser 

;//////////////////////////////////////////////////////////////////////////////////////
;Microsoft LogParser 2.2 - COM Demo - uses : concatenation
;                                     convert to StrCat() if needed
;
;Calculates MD5 Hash for all XML files on Drive c:
;displays output in DataGrid - no WB errorhandler
;
;Logparser 2.2 must be installed and registered
;To download version 2.2
;http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx
;
;Stan Littlefield, July 18, 2009
;//////////////////////////////////////////////////////////////////////////////////////
;see NOTES at bottom of script for Logparser Format Options
;//////////////////////////////////////////////////////////////////////////////////////

;set variables  - modify to suit your own needs
;this sample query is set to display the MD5_Hash for xml files recursing 2 subdirs
;from the root. Error messages will report folders where access was denied.
cPath = "C:\*.*"
ext = "xml"
cSQL = "SELECT Path,Name, HASHMD5_FILE(Path)AS MD5_Hash FROM %cPath% where EXTRACT_EXTENSION(Name) = '%ext%' "

;begin processing
BoxOpen("Please Wait...","Processing LogParser Query":@CRLF:cSQL)
;create query,input and output objects
oLog = CreateObject("MSUtil.LogQuery")
;default for error parsing is -1, which means errors will be discarded
oLog.maxParseErrors = 100

oInput = CreateObject("MSUtil.LogQuery.FileSystemInputFormat.1")
oInput.recurse = 2  ;-1=total recursion to all subdirectories
                    ;0=current directory only - no recursion
                    ;n=recurse n subfolder levels

;create output format object
;see notes for other available formats
oOut = CreateObject("MSUtil.LogQuery.DataGridOutputFormat.1")

;execute and check for errors
;errors results, if any, will display after datagrid
BoxShut()
oLog.ExecuteBatch(cSQL, oInput, oOut)
If oLog.lastError <> 0
   cErrors = "Errors:":@CRLF
   ForEach strMessage In oLog.errorMessages
        cErrors=cErrors:strMessage:@CRLF
   Next
   Pause("There were Errors or Warnings!!!",cErrors)
EndIf
oOut=0
oInput=0
oLog=0
Exit
;//////////////////////////////////////////////////////////////////////////////////////

;NOTES
;//////////////////////////////////////////////////////////////////////////////////////
Input Formats

IIS Log File Input Formats
IISW3C: parses IIS log files In the W3C EXTENDED Log File Format.
IIS: parses IIS log files In the Microsoft IIS Log File Format.
BIN: parses IIS log files In the Centralized Binary Log File Format.
IISODBC: returns database records from the tables logged To By IIS when configured To log In the ODBC Log Format.
HTTPERR: parses HTTP error log files generated By Http.sys.
URLSCAN: parses log files generated By the URLScan IIS filter.

Generic Text File Input Formats
CSV: parses comma-separated values text files.
TSV: parses TAB-separated and space-separated values text files.
XML: parses XML text files.
W3C: parses text files In the W3C EXTENDED Log File Format.
NCSA: parses web SERVER log files In the NCSA Common, Combined, and EXTENDED Log File Formats.
TEXTLINE: returns lines from generic text files.
TEXTWORD: returns words from generic text files.

System Information Input Formats
EVT: returns events from the Windows Event Log and from Event Log backup files (.evt files).
FS: returns information ON files and directories.
REG: returns information ON registry values.
ADS: returns information ON Active Directory objects.

Special-purpose Input Formats
NETMON: parses network capture files created By NetMon.
ETW: parses Enterprise Tracing For Windows trace log files and live sessions.
COM: provides an interface To Custom Input Format COM Plugins.

;//////////////////////////////////////////////////////////////////////////////////////
Output Formats

Generic Text File Output Formats
NAT: formats output records as readable tabulated columns.
CSV: formats output records as comma-separated values text.
TSV: formats output records as TAB-separated or space-separated values text.
XML: formats output records as XML documents.
W3C: formats output records In the W3C EXTENDED Log File Format.
TPL: formats output records following user-defined templates.
IIS: formats output records In the Microsoft IIS Log File Format.

Special-purpose Output Formats
SQL: uploads output records To a table In a SQL database.
SYSLOG: sends output records To a Syslog server.
DATAGRID: displays output records In a graphical user interface.
CHART: creates image files containing charts.

;//////////////////////////////////////////////////////////////////////////////////////

Article ID:   W18087
Filename:   Query XML Files for MD5 Hash .txt
File Created: 2009:07:20:09:25:28
Last Updated: 2009:07:20:09:25:28