RE: Empty Event Logs from Windows 2003 Server,Win32_NTLogEvent,WMI



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


"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

.



Relevant Pages

  • Empty Event Logs from Windows 2003 Server,Win32_NTLogEvent,WMI
    ... I am not able to fetching the Event Log Info from My Machine ... Iam able to connect the Server Machine but iam unable to get any event log ... Dim oConn As New ConnectionOptions ... Dim Scope As ManagementScope ...
    (microsoft.public.dotnet.security)
  • Backup and Clear Event Logs
    ... I have a script that backs up and clears event logs and saves the file to a ... Dim dtmThisMonth 'Variable to hold current month ... dtmToday & vbTab & "Event Log Maintenance Successful." ... LogFile oFile, dtmToday & vbTab & "Error Backing up event log: ...
    (microsoft.public.windows.server.scripting)
  • Re: adding error checking to code
    ... The statement "On Error GoTo 0" restores normal error handling, ... ' Trap error if folder cannot be created. ... ' Setup for event log. ... Dim errorFolder ...
    (microsoft.public.scripting.vbscript)
  • WMI Reports a different time than the Event Viewer
    ... Application Event log for each machine running SQL Server using WMI and safe ... Here is the code I use to pull the data from the Application Event Log ... Dim objWMIService As Object ... Dim intLatestEvent As Variant ...
    (microsoft.public.windowsxp.wmi)
  • Copying Events to a Database
    ... ' of the computers event log to an Access Database, ... Dim objConnection ... Dim dtmThisMonth ... Set objConnection = CreateObject ...
    (microsoft.public.scripting.vbscript)