Proper usage of eventquery.vbs



  • Windows XP ships with a program called eventquery.vbs in \Windows\System32.  I opened it up to see how it works.  Near the top, along with all the other constants, I see this:

    [color=green]' Contents for showing help for Usage [/color]
    [color=blue]CONST[/color] L_ShowUsageLine00_Text            = [color=maroon]"No logs are available on this system for query."[/color]
    [color=blue]CONST[/color] L_ShowUsageLine01_Text            = [color=maroon]"EVENTQUERY.vbs [/S system [/U username [/P password]]] [/FI filter]"[/color]
    [color=blue]CONST[/color] L_ShowUsageLine02_Text            = [color=maroon]"               [/FO format] [/R range] [/NH] [/V] [/L logname | ]"[/color]
    [color=blue]CONST[/color] L_ShowUsageLine03_Text            = [color=maroon]"Description:"[/color]
    [color=blue]CONST[/color] L_ShowUsageLine04_Text            = [color=maroon]"    The EVENTQUERY.vbs script enables an administrator to list"[/color]
    [color=blue]CONST[/color] L_ShowUsageLine05_Text            = [color=maroon]"    the events and event properties from one or more event logs."[/color]
    ...

    At the very bottom of the file, nearly 2000 lines later, there's this:

    [color=green]'[/color]
    [color=green]'
    Sub:     ShowUsage[/color]
    [color=green]'
    [/color]
    [color=green]'
    Purpose: Shows the correct usage to the user.[/color]
    [color=green]'
    [/color]
    [color=green]'
    Output:  Help messages are displayed on screen.[/color]
    [color=green]'
    [/color]
    [color=green]'
    *******[/color]

    [color=blue]Private[/color] [color=blue]Sub[/color] ShowUsage ()

        WScript.Echo EmptyLine_Text    
        WScript.Echo L_ShowUsageLine01_Text       
        WScript.Echo L_ShowUsageLine02_Text       
        WScript.Echo EmptyLine_Text    
        WScript.Echo L_ShowUsageLine03_Text       
        WScript.Echo L_ShowUsageLine04_Text       
        WScript.Echo L_ShowUsageLine05_Text       
        WScript.Echo EmptyLine_Text   
        WScript.Echo L_ShowUsageLine06_Text      
        WScript.Echo L_ShowUsageLine07_Text      
        WScript.Echo EmptyLine_Text     
        WScript.Echo L_ShowUsageLine08_Text      
        WScript.Echo L_ShowUsageLine09_Text     
        WScript.Echo EmptyLine_Text     
        WScript.Echo L_ShowUsageLine10_Text     
        WScript.Echo L_ShowUsageLine11_Text 
        WScript.Echo EmptyLine_Text      
        WScript.Echo L_ShowUsageLine12_Text        
        WScript.Echo L_ShowUsageLine13_Text 
        WScript.Echo EmptyLine_Text      
        WScript.Echo L_ShowUsageLine14_Text       
        WScript.Echo L_ShowUsageLine15_Text       
        WScript.Echo EmptyLine_Text 
        WScript.Echo L_ShowUsageLine16_Text     
        WScript.Echo L_ShowUsageLine17_Text     
        WScript.Echo L_ShowUsageLine18_Text 
        WScript.Echo EmptyLine_Text   
        WScript.Echo L_ShowUsageLine19_Text     
        WScript.Echo L_ShowUsageLine20_Text  
        WScript.Echo L_ShowUsageLine21_Text  
        WScript.Echo L_ShowUsageLine22_Text
        WScript.Echo L_ShowUsageLine23_Text
        WScript.Echo EmptyLine_Text
        WScript.Echo L_ShowUsageLine24_Text     
        WScript.Echo L_ShowUsageLine25_Text     
        WScript.Echo L_ShowUsageLine26_Text 
        WScript.Echo EmptyLine_Text       
        WScript.Echo L_ShowUsageLine27_Text        
        WScript.Echo EmptyLine_Text    
        WScript.Echo L_ShowUsageLine28_Text        
        WScript.Echo EmptyLine_Text        
        WScript.Echo L_ShowUsageLine29_Text       
        WScript.Echo L_ShowUsageLine30_Text      
        WScript.Echo L_ShowUsageLine31_Text      
        WScript.Echo L_ShowUsageLine32_Text      
        WScript.Echo L_ShowUsageLine33_Text      
        WScript.Echo L_ShowUsageLine34_Text      
        WScript.Echo L_ShowUsageLine35_Text        
        WScript.Echo L_ShowUsageLine36_Text        
        WScript.Echo L_ShowUsageLine37_Text        
        WScript.Echo L_ShowUsageLine38_Text        
        WScript.Echo EmptyLine_Text
        WScript.Echo L_ShowUsageLine39_Text       
        WScript.Echo L_ShowUsageLine40_Text      
        WScript.Echo EmptyLine_Text
        WScript.Echo L_ShowUsageLine41_Text       
        WScript.Echo L_ShowUsageLine42_Text       
        WScript.Echo L_ShowUsageLine43_Text       
        WScript.Echo L_ShowUsageLine44_Text     
        WScript.Echo L_ShowUsageLine45_Text     
        WScript.Echo L_ShowUsageLine46_Text     
        WScript.Echo L_ShowUsageLine47_Text    
        WScript.Echo L_ShowUsageLine48_Text    
        WScript.Echo L_ShowUsageLine49_Text    
        WScript.Echo L_ShowUsageLine50_Text    
        WScript.Echo L_ShowUsageLine51_Text   
        WScript.Echo L_ShowUsageLine52_Text   
        WScript.Echo L_ShowUsageLine53_Text   

    [color=blue]End Sub[/color]



  •  Was this written by SpectateSwamp? Will it display log entries randomly in 2-3 second intervals? SpectateSwamp must be a Microsoft developer...



  • Of course it was, SpectateSwamp is the last word in event querying, AND noodling!



  • I can see a somewhat logical reason for the constants. Perhaps the legal or marketting had to come up with the screen, so the original author used constants for easy modification.

     The real WTF, is that they didn't just use ONE constant with embedded line breaks.



  • The real WTF is that they used VBScript.

         -dZ. 



  • @Jonathan Holland said:

    I can see a somewhat logical reason for the constants. Perhaps the legal or marketting had to come up with the screen, so the original author used constants for easy modification.

    Pretty good theory. I like that idea too, except the ShowUsage sub is right at the end of the script and the constants are awkwardly in the middle of an alphabetical list of variables. Surely finding and editing the sub would have been easier.



  • @yet another Matt said:

    ... the constants are awkwardly in the middle of an alphabetical list of variables.
     

    I think you missed the

    [code]'----------------------------------------------------------------
    ' Start of localization Content
    '----------------------------------------------------------------
    [/code]and
    [code]'-------------------------------------------------------------------------
    ' END of localization content
    '-------------------------------------------------------------------------[/code]

    comments.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.