Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WMI Event Provider - Access Denied

5 views
Skip to first unread message

Dan

unread,
Oct 11, 2000, 3:00:00 AM10/11/00
to
I am trying to write a program that will monitor local events and upload
them to a SQL database. However, I always get an Access Denied error when I
try to do this. It works perfectly when I specify remote machines, but it
bombs when i specify the local machine.

I have used sample code from the W2K resource kit as well as other places,
and I always get the access denied error. Does anyone know why I might be
getting this problem?

Thanks,
Dan

Andrea Cuozzo

unread,
Oct 11, 2000, 3:00:00 AM10/11/00
to
You'll have probably already done this, but it looks like WMI doesn't like
specifying username and password when connecting to the local computer:
you're not using username and password when connecting locally, are you ?

bye
Andrea

"Dan" <dal...@towson.edu> wrote in message
news:O40vdH6MAHA.247@cppssbbsa05...

Dan

unread,
Oct 11, 2000, 3:00:00 AM10/11/00
to
No, I am not specifying username/password, just using the pass-through auth.
I think I've also tried most of the security/impersonation levels. I just
don't understand why i can access remote machines, but not my own!


"Andrea Cuozzo" <andrea...@reti.it> wrote in message
news:OXVwjJ6MAHA.247@cppssbbsa05...

DFENS

unread,
Oct 13, 2000, 12:35:34 AM10/13/00
to
At what point do you get the access denied? Connecting to WMI, registering
for the events, uploading to the SQL DB, ???

Dan

unread,
Oct 13, 2000, 3:00:00 AM10/13/00
to
I get the error when I register for the events. (oEnumerator.NextEvent)  Here is my code, problem line in Red:
 
    sWBEMClass = "Win32_NTLogEvent"
    sNamespace = "root\cimv2"
    Set oLocator = CreateObject("WbemScripting.SWbemLocator")
    Set oService = oLocator.ConnectServer(sServer, sNamespace) oService.Security_.ImpersonationLevel = 1
    sQuery = "Select * from __InstancecreationEvent where TargetInstance isa ""Win32_NtLogEvent"""
    oService.Security_.AuthenticationLevel = 2
   Set oEnumerator = oService.ExecNotificationQuery(sQuery)
    Do
        Set oInstance = oEnumerator.NextEvent 'This is where I get Access Denied.
        DumpToDataBase (oInstance.TargetInstance)
    Loop
 

Manfred Braun

unread,
Oct 13, 2000, 3:00:00 AM10/13/00
to
Hello Dan,
 
 you try to read from all existing eventlogs, this includes the security log. To read that, you have additional to specify:
 
  objService.Security_.Privileges.AddAsString("SeSecurityPrivilege")
That should do the job.
 
Best regards,
Manfred Braun
 
(Private)
Lange Roetterstrasse 7
D68167 Mannheim
Germany
 
mailto:_mb...@manfred.mannheim-netz.de
Phone : +49-621-37 53 86
(Remove the anti-spam-underscore to mail me!)
I get the error when I register for the events. (oEnumerator.NextEvent)  Here is my code, problem line in Red:
 
    sWBEMClass = "Win32_NTLogEvent"
    sNamespace = "root\cimv2"
    Set oLocator = CreateObject("WbemScripting.SWbemLocator")
    Set oService = oLocator.ConnectServer(sServer, sNamespace) oService.Security_.ImpersonationLevel = 1
    sQuery = "Select * from __InstancecreationEvent where TargetInstance isa ""Win32_NtLogEvent"""
    oService.Security_.AuthenticationLevel = 2
   Set oEnumerator = oService.ExecNotificationQuery(sQuery)
    Do
        Set oInstance = oEnumerator.NextEvent 'This is where I get Access Denied.
        DumpToDataBase (oInstance.TargetInstance)
    Loop
 

Dan

unread,
Oct 16, 2000, 3:00:00 AM10/16/00
to
Thank you!!  That worked like a charm!
 
Howeber, I do have one question.  Why do I have to specify that line when I use my local machine and not a remote machine?
 

Bobby Malik

unread,
Oct 16, 2000, 3:00:00 AM10/16/00
to
Try using Monikers. They usually work with local machines instead of the
locator object.

Bobby Malik


"Dan" <dal...@towson.edu> wrote in message

news:uSmaAL7MAHA.195@cppssbbsa05...


> No, I am not specifying username/password, just using the pass-through
auth.
> I think I've also tried most of the security/impersonation levels. I just
> don't understand why i can access remote machines, but not my own!
>
>
>
>
> "Andrea Cuozzo" <andrea...@reti.it> wrote in message
> news:OXVwjJ6MAHA.247@cppssbbsa05...
> > You'll have probably already done this, but it looks like WMI doesn't
like
> > specifying username and password when connecting to the local computer:
> > you're not using username and password when connecting locally, are you
?
> >
> > bye
> > Andrea
> >

Manfred Braun

unread,
Oct 16, 2000, 3:00:00 AM10/16/00
to
Hi Dan,
 
 don't know. Normally, even administrators have to specify that right. I don't know w2k and the details on setting permissions for WMI, because that's not available to WMI on NT4.
 
Best regards,
Manfred
0 new messages