Event Viewer Errors/Warnings

  • Using SQL Server 2005, and very new to SSIS--where did DTS go...?

    Anyway, I need to connect to multiple servers, and get any errors or warnings that appear in the Application or System event viewers. I've been looking for scripts on the internet since last week, and only have one that I think just allows connection to a specified machine and lists the number of logs present (...did I mention I'm new to SSIS?).

    Anyway, here is the code that I have so far, and it does execute without a problem, but I don't know how to verify that it is connecting or "reading" the event logs.

    Any suggestions would be very much appreciated.

    Imports System

    Imports System.Data

    Imports System.Diagnostics

    Imports System.Threading

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Runtime

    Public Class ScriptMain

    ' The execution engine calls this method when the task executes.

    ' To access the object model, use the Dts object. Connections, variables, events,

    ' and logging features are available as static members of the Dts class.

    ' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.

    '

    ' To open Code and Text Editor Help, press F1.

    ' To open Object Browser, press Ctrl+Alt+J.

    Public Shared Function GetEventLogs(ByVal machineName As String) As EventLog()

    Dim returnValue As EventLog()

    returnValue = EventLog.GetEventLogs(machineName)

    End Function

    Public Sub Main()

    Dim remoteEventLogs() As EventLog

    remoteEventLogs = EventLog.GetEventLogs("myserver")

    Console.WriteLine(("Number of logs on computer: " & remoteEventLogs.Length))

    Dim log As EventLog

    For Each log In remoteEventLogs

    Console.WriteLine(("Log: " & log.Log))

    Next log

    Dts.TaskResult = Dts.Results.Success

    End Sub

    End Class

    Alan H
    MCSE - Data Management and Analytics
    Senior SQL Server DBA

    Best way to ask a question: http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • What are you looking for? If you want to add soem pregress messages, you could use dts.events.firexxxxx

    Those will write out the event to the progress and if you have any logging on the package, it will log them as well.

    If you want to use the data and push it into SQL, you are better off using a Script Component as a source and pushing them down.

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply