[python-win32] Re: LsaAddAccountRights help

Gustavo Tabares gustabares at verizon.net
Wed Apr 13 03:29:29 CEST 2005

It worked perfectly. Thank you.....

-----Original Message-----
From: python-win32-bounces at python.org
[mailto:python-win32-bounces at python.org] On Behalf Of Roger Upole
Sent: Tuesday, April 12, 2005 6:47 PM
To: python-win32 at python.org
Subject: [python-win32] Re: LsaAddAccountRights help

   The third parm should be a sequence of privilege names.
Looks like the argument parsing isn't checking that it's a
sequence.  Also, that particular privilege constant
(SE_SERVICE_LOGON_NAME) isn't defined
anywhere yet.  I'll correct both of those problems shortly.
For the meantime, you should be able to use
win32security.LsaAddAccountRights( policy_handle, sid_obj,
('SeServiceLogonRight',) )

----- Original Message ----- 
From: Gustavo  <mailto:gustabares at verizon.net> Tabares 
To: python-win32 at python.org 
Sent: Tuesday, April 12, 2005 6:19 PM
Subject: [python-win32] LsaAddAccountRights help


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/664114ae/attachment.html

More information about the Python-win32 mailing list