Home All Groups Group Topic Archive Search About

Empty Event Logs from Windows 2003 Server,Win32_NTLogEvent,WMI

Author
27 May 2009 3:41 PM
suresh at his best
Good  Morning,
      I am not able to  fetching the Event Log Info from My Machine(domain1)
to ServerMachine(domain2).
Iam able to connect the Server Machine but iam unable to get any event log
data from that server machine.

Here i have two things
    1 . From  Server iam able to connect to my machine even log and get the
result
    2: From my machine iam able to connect to the server but unable to read
the event log.

The Following is the code i have tried from my machine

Dim oConn As New ConnectionOptions
        Dim Scope As ManagementScope
       oConn.Username = "elog"
        oConn.Password = "xxx"
        oConn.Authority = "ntlmdomain:domain2 "
        Scope = New ManagementScope("\\machineserver\root\cimv2", oConn)

        Scope.Connect()

        Dim Query As New ObjectQuery("SELECT * FROM Win32_NTLogEvent")

        Dim searcher As ManagementObjectSearcher
        searcher = New ManagementObjectSearcher(Scope, Query)

        Dim queryCollection As ManagementObjectCollection
        queryCollection = searcher.Get()

        Dim insertionStrings As String()
        Dim m As ManagementObject
        Dim s As String
        Dim message As String
        For Each m In queryCollection
            MsgBox(m("EventIdentifier"))
            MsgBox(m("Message"))
            MsgBox(m("Type"))
            insertionStrings = m("InsertionStrings")
            message = ""
            For Each s In insertionStrings
                message = message & s & vbCrLf
            Next
            MsgBox(message)
        Next
    Could you help me with the above

Thanks and Regards
Suresh

Author
9 Jun 2009 4:51 PM
dotNetDave
Usually your app needs to be running under a domain user that has access
rights to Event Logs on other machines. This is the only way I have been able
to get it to work. It's a pain to setup if you are in a large company, but it
works the best.

David


======================================
David McCarter [Microsoft MVP]
www.dotNetTips.com
David McCarter''s .NET Coding Standards available at:
http://codingstandards.notlong.com


Show quoteHide quote
"suresh at his best" wrote:

> Good  Morning,
>       I am not able to  fetching the Event Log Info from My Machine(domain1)
> to ServerMachine(domain2).
> Iam able to connect the Server Machine but iam unable to get any event log
> data from that server machine.
>
> Here i have two things
>     1 . From  Server iam able to connect to my machine even log and get the
> result
>     2: From my machine iam able to connect to the server but unable to read
> the event log.
>
> The Following is the code i have tried from my machine
>
> Dim oConn As New ConnectionOptions
>         Dim Scope As ManagementScope
>        oConn.Username = "elog"
>         oConn.Password = "xxx"
>         oConn.Authority = "ntlmdomain:domain2 "
>         Scope = New ManagementScope("\\machineserver\root\cimv2", oConn)
>
>         Scope.Connect()
>
>         Dim Query As New ObjectQuery("SELECT * FROM Win32_NTLogEvent")
>
>         Dim searcher As ManagementObjectSearcher
>         searcher = New ManagementObjectSearcher(Scope, Query)
>
>         Dim queryCollection As ManagementObjectCollection
>         queryCollection = searcher.Get()
>
>         Dim insertionStrings As String()
>         Dim m As ManagementObject
>         Dim s As String
>         Dim message As String
>         For Each m In queryCollection
>             MsgBox(m("EventIdentifier"))
>             MsgBox(m("Message"))
>             MsgBox(m("Type"))
>             insertionStrings = m("InsertionStrings")
>             message = ""
>             For Each s In insertionStrings
>                 message = message & s & vbCrLf
>             Next
>             MsgBox(message)
>         Next
>     Could you help me with the above
>
> Thanks and Regards
> Suresh       
>