[python-win32] LsaAddAccountRights help

Gustavo Tabares gustabares at verizon.net
Wed Apr 13 00:19:05 CEST 2005


I'm trying to give a user a "Log on as a Service" right using the Python
Win32 modules. Here is the code in question:

#!/usr/bin/env python

import win32security

username = "Administrator"
system_name = "temp_system"

policy_handle = win32security.LsaOpenPolicy(system_name,
sid_obj, domain, tmp = win32security.LookupAccountName(system_name,
win32security.LsaAddAccountRights( policy_handle, sid_obj,
win32security.SE_SERVICE )
win32security.LsaClose( policy_handle )

I'm running this code as Administrator, so having the proper permissions
to perform this operation shouldn't be a question. Here is what I'm
getting when I run the above code:

Traceback (most recent call last):
  File "C:\example.py", line 12, in ?
    win32security.LsaAddAccountRights( policy_handle, sid_obj,
win32security.SE_SERVICE )
SystemError: error return without exception set

I'm cluess as to what is going on. Any help is appreciated. By the way,
I'm using Python 2.3.3 with PythonWin32 build 202.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20050412/488a636c/attachment.html

More information about the Python-win32 mailing list