Windows Scripting
  Home arrow Windows Scripting arrow Page 3 - Event Log Parsing for the WSH Administrato...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Event Log Parsing for the WSH Administrator
By: Nilpo/Developer Shed Staff Writer
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 2
    2007-05-23

    Table of Contents:
  • Event Log Parsing for the WSH Administrator
  • Modularizing the script
  • Polling machines across a network
  • Monitoring event logs

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Event Log Parsing for the WSH Administrator - Polling machines across a network


    (Page 3 of 4 )

    Since WMI supports working with remote computers, we just need to change our script so that it polls each computer in our array in turn.  To do this, we’ll need to recreate the WMI service object for each machine.  We’ll begin by creating a For loop to move through the array.

    strConnection = "Provider=Microsoft.Jet.OLEDB.4.0; " _

       & "Data Source=C:events.mdb"

     

    arrComputers = Array("machine1", _

       "machine2", _

       "machine3")

     

    If objFso.FileExists("C:events.mdb") Then

       oConn.Open strConnection

    Else

       BuildDatabase

    End If

     

    For i = 0 To UBound(arrComputers)

       strComputer = arrComputers(i)

       Set objWMIService = GetObject("winmgmts:" _

           & "{impersonationLevel=impersonate}!" & strComputer _

           & "rootcimv2")

       GetEvents

       Set objWMIService = Nothing

    Next

     

    oConn.Close

    This simply moves through each computer name in our array, connects to the WMI Service, and then calls the GetEvents subroutine to retrieve the events on that machine.

    Function Date2String(objTime)

        yyyy = Left(objTime, 4)

        mm = Mid(objTime, 5, 2)

        dd = Mid(objTime, 7, 2)

        hh = Mid(objTime, 9, 2)

        min = Mid(objTime, 11, 2)

        sec = Mid(objTime, 13, 2)

        Date2String = mm & "/" & dd & "/" & yyyy & " " & hh & ":" & min & ":" & sec

    End Function

    Don’t forget to add all required subroutines to your completed script.

    More Windows Scripting Articles
    More By Nilpo/Developer Shed Staff Writer


       · Wrapping up this 3-part series, I wanted to demonstrate ways for network...
     

    WINDOWS SCRIPTING ARTICLES

    - A Portable Scripting Toolbox
    - WPF Through an Example: Introduction
    - Beginning SharePoint Web Part Development
    - More Alternative Languages for WSH
    - WPF Control Layout
    - WSH in Other Languages
    - Screen Capturing via GDI+ and GDI
    - Understanding Procedures in VBScript
    - Printing Documents in WSH
    - Generating Outlook Signatures Based on Activ...
    - VBScript: Converting and Formatting with Fun...
    - VBScript: Conversion and Format Functions
    - VBScript: Array Functions
    - VBScript: Strings, You Can`t Function withou...
    - VBScript: More String Functions





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway