inf200...@ucf.edu.cu wrote:
> I'm having problems recieving local wmi events from Win32_NTLogEvent class. 
> It turns
> out that I want to know which user starts or stops services. I set a watcher 
> for that
> propose and it raises the following exception:
>
> x_access_denied: <x_wmi: Unexpected COM Error (-2147352567, 'Ocurri\xf3 una 
> exce
> pci\xf3n.', (0, u'SWbemServicesEx', u'Acceso denegado ', None, 0, 
> -2147217405),
> None)>
>
> I have done the same with other classes and everything works just fine.
>
> The script is running from the system's administration account. Do I need to 
> provide
> extra privileges in con = wmi.WMI()?
>
> Could anyone help me figure out what is happening, please?

Did you look at the documentation?
    http://msdn.microsoft.com/en-us/library/aa394226.aspx
The very first paragraph says:

    An application must have SeSecurityPrivilege to receive events from
    the security event log, otherwise "Access Denied" is returned to the
    application.

-2147217405 is 0x80041003, which is WBEM_E_ACCESS_DENIED, just like it says.

It takes a surprising amount of code to acquire a privilege.  Here is
some Python code that shows how to do it:
   
http://windows-privesc-check.googlecode.com/svn-history/r10/trunk/windows-privesc-check.py
Check "get_extra_privs" about half-way through.  You can simplify it a
little bit, since you are looking for exactly one privilege.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to