| |
phunkodelic
Posts: 1
Score: 0
Joined: 11/18/2005
Status: offline
|
Trying to integrate my SQL into VBScript. The reason I want to do this is so I can pass variables into the SQL. The varialbes would be for the file paths, file names, server name, and log file name. Please not that the variables are NOT in the following example. The following example does not work. It will run, but for what ever reason it skipps over all the sql part of it. Any Help would be much apprecaited. Thanks a bunch. If you have suggestions as to how to make this easiwer I am all ears. Declare Variables and set Value for Variables Option Explicit Dim objlogparser 'run logparser to backup files Set objlogparser = WScript.CreateObject("WScript.Shell") wscript.echo "processed set" objlogparser.Run("%comspec% /c LogParser.exe -i:CSV -headerRow:ON -tpl:Mylogs005.tpl -o:TPL " _ & chr(34) & "SELECT 'Server' AS %EventLog%, /* Title of the page */" _ & "RecordNumber,"_ & "ComputerName AS Computer,"_ & "CASE TO_UPPERCASE(SUBSTR(EventTypeName,0,4))" _ & "WHEN 'ERRO' THEN 'ERROR'"_ & "ELSE TO_UPPERCASE(SUBSTR(EventTypeName,0,4))"_ & "END AS Type,"_ & "TO_STRING(TimeGenerated, 'dddd, MMMM d, yyyy') AS LongTimeStamp,"_ & "TO_STRING(TimeGenerated, 'M/d hh:mm:ss') AS ShortTimeStamp,"_ & "SourceName,"_ & "EventCategoryName AS Category,"_ & "EventID,"_ & "COALESCE(SID, 'N/A') AS LongUser,"_ & "COALESCE( REPLACE_STR( REPLACE_STR(SID,'NT AUTHORITY\\',''),'%USERDOMAIN%\\',''), 'N/A') AS ShortUser,"_ & "Message,"_ & "CASE EventID" _ & "/* ------- High ------- */"_ & "-- Logon failure"_ & "WHEN 529 THEN '#FF0000'"_ & "WHEN 534 THEN '#CC0000'"_ & "-- Account lockout"_ & "WHEN 539 THEN '#FF3300'"_ & "-- Domain logon failure"_ & "WHEN 675 THEN '#CC3300'"_ & "WHEN 676 THEN '#990000'"_ & "WHEN 677 THEN '#993300'"_ & "/* ------- Medium ------- */"_ & "-- Object access"_ & "WHEN 560 THEN '#FF9900'"_ & "WHEN 562 THEN '#CC6600'"_ & "-- Object deletion"_ & "WHEN 563 THEN '#FF6600'"_ & "WHEN 564 THEN '#CC9900'"_ & "-- Act as part of OS"_ & "WHEN 577 THEN '#FF6633'"_ & "WHEN 578 THEN '#CC6633'"_ & "/* ------- Low ------- */"_ & "-- Successful log on/off"_ & "WHEN 528 THEN '#00FF00'"_ & "WHEN 538 THEN '#66FF00'"_ & "WHEN 540 THEN '#CCFF00'"_ & "-- Account misuse"_ & "WHEN 530 THEN '#00FF66'"_ & "WHEN 531 THEN '#66FF66'"_ & "WHEN 532 THEN '#CCFF66'"_ & "WHEN 533 THEN '#00FFCC'"_ & "-- Privileges added to token"_ & "WHEN 576 THEN '#00CC66'"_ & "-- Terminal services"_ & "WHEN 682 THEN '#66CC66'"_ & "WHEN 683 THEN '#66CC33'"_ & "-- Everything else"_ & "ELSE '#C0C0FF'"_ & "END AS CellColor"_ & "INTO H:\Log_parser\HTML_reports\domctl1-ServerEventLog.html"_ & "FROM H:\Log_parser\backup_logs\11-4-2005\domctl1-Security.csv"_ & "ORDER BY EventID, ShortTimeStamp" & chr(34)),7, True wscript.echo "script complete"
|
|