[python-win32] Re: LsaAddAccountRights help

Roger Upole rwupole at msn.com
Wed Apr 13 00:47:27 CEST 2005


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',) )

    hth 
       Roger

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


  Hello, 

  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, win32security.POLICY_ALL_ACCESS) 
  sid_obj, domain, tmp = win32security.LookupAccountName(system_name, username) 
  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.



  Thanks, 
  Gus 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20050412/20c7bde1/attachment.html


More information about the Python-win32 mailing list