Re: Access Denied on a ManagementEventWatcher to Remote System



I've already tried all authentication levels with no success. I switched
from Asynchronous processing (_watcher.Start() ) to synchronous
(_watcher.WaitForNextEvent ) and that has resolved the issue. I'd prefer to
do asynchronous processing, but based on all the internet posts and msdn
posts it is just way too much of a hassle because of the reverse connections,
firewalls, credentials passing across threads, etc...

Seems like it shouldn't be that hard.

"mabra" wrote:

Hi !

Ok, try:

scope.Options.Impersonation = ImpersonationLevel.Impersonate;
scope.Options.Authentication = AuthenticationLevel.Connect;

Let's see, if this helps.
I can offer to send you a working C# sample, if you mail me.

Best regards,
Manfred

mabra AT manfbraun.<country>
[my country is de] ;-)



Carl Klouda wrote:
Thanks for the response:

I set the event handler by declaring _watcher "withevents" and then if you
notice the SecurityArrivedEventHandler "Handles _watcher.EventArrived"

I re-read my post and admit that it was confusing. What I meant was that if
I installed and ran the application on the remote device, of course without
the credential information, it works fine. If I try to run the application
on my PC with the managementpath pointed to the remote device and specify
credentials, it does not work.

I have tried EnablePrivileges and supplied an administrator user account in
the form domain\userid. It still did not work. I've also tried setting the
authentication modes to packet, packetpricvacy, and connect with no luck.

"mabra" wrote:

Hi !

Some notes.
This code cannot run locally, because you are specifying credentials.
I see no source, which set's the eventhandler.
I would recommend to try two things:

a) scope.Options.EnablePrivileges = True
b) use 'scope.Options.Username = "remoteserver\adminuser"'

May be this helps.

Best regards,
Manfred

Carl Klouda wrote:
Been struggling to get a managementeventwatcher working for a remote system.
Running the app on a WinXP system. I've tried to connect to Windows 2000 and
Windows 2003.

The app is simple and just monitors/queries the System Event log on a remote
system. Works fine if you run it on the remote system directly without
credentials. The user id and pwd I use for the remote connections is a local
admin on the remote system.

My code is below. (Note that scope.Connect() works fine, but
_watcher.Start() returns the access denied)

'//////////////////////////////////////////////////////////////////////////////////

Imports System
Imports System.Management

Public Class SecWatcher
Private WithEvents _watcher As ManagementEventWatcher

Public Sub Start()
Dim scope As New ManagementScope("\\remoteserver\root\cimv2")
scope.Options.Username = "adminuser"
scope.Options.Password = "adminpass"
scope.Options.Impersonation = ImpersonationLevel.Impersonate


scope.Connect()

Dim wql As New WqlEventQuery("SELECT * FROM __InstanceCreationEvent
WITHIN 3 WHERE TargetInstance ISA 'Win32_NTLogEvent' and
TargetInstance.LogFile = 'System'")
_watcher = New ManagementEventWatcher()
_watcher.Query = wql
_watcher.Scope = scope
_watcher.Start()
End Sub

Public Sub [Stop]()
_watcher.Stop()
End Sub

Private Sub SecurtyEventArrivedHandler(ByVal sender As Object, ByVal e
As EventArrivedEventArgs) Handles _watcher.EventArrived
Console.WriteLine(DateTime.Now.ToString & " -- " &
CType(e.NewEvent("TargetInstance"), ManagementBaseObject)("ComputerName") & "
-- " & CType(e.NewEvent("TargetInstance"), ManagementBaseObject)("Message"))
End Sub

End Class


.



Relevant Pages

  • Re: Access Denied on a ManagementEventWatcher to Remote System
    ... I installed and ran the application on the remote device, ... because you are specifying credentials. ... Private WithEvents _watcher As ManagementEventWatcher ... Public Sub Start ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Remote via RAS
    ... resources in the remote network. ... Give the credentials when you try to access the shares. ... > use a RAS connection to gain access to the network. ... > I have 14 remote users running Windows XP also connecting up to the ...
    (microsoft.public.win2000.networking)
  • Re: Nightmare with saved credentials
    ... There has been quite a design change in the new rdp client. ... Vista Remote Desktop Connection Authentication FAQ ... credentials, ...
    (microsoft.public.windows.terminal_services)
  • Re: A services threads outgoing security:how to manage?
    ... Under Windows 2003 Server, ... > ALICE's credentials, after impersonating local resources will be accessed ... > using BOB's token while remote resources will be accessed using ALICE's ...
    (microsoft.public.security)
  • Re: A services threads outgoing security:how to manage?
    ... Under Windows 2003 Server, ... > ALICE's credentials, after impersonating local resources will be accessed ... > using BOB's token while remote resources will be accessed using ALICE's ...
    (microsoft.public.dotnet.security)

Loading