<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.2900.2604" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=062332701-13042005><FONT face=Arial color=#0000ff size=2>It 
worked perfectly. Thank you.....</FONT></SPAN><SPAN 
class=062332701-13042005><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN></DIV>
<DIV><SPAN class=062332701-13042005><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=062332701-13042005><FONT face=Arial color=#0000ff 
size=2>Gus</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> 
  python-win32-bounces@python.org [mailto:python-win32-bounces@python.org] <B>On 
  Behalf Of </B>Roger Upole<BR><B>Sent:</B> Tuesday, April 12, 2005 6:47 
  PM<BR><B>To:</B> python-win32@python.org<BR><B>Subject:</B> [python-win32] Re: 
  LsaAddAccountRights help<BR><BR></FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp; The third parm should be a sequence 
  of privilege names.</FONT></DIV>
  <DIV><FONT face=Arial size=2>Looks like the argument parsing isn't checking 
  that it's a</FONT></DIV>
  <DIV><FONT face=Arial size=2>sequence.&nbsp; Also, that particular privilege 
  constant</FONT></DIV>
  <DIV><FONT face=Arial size=2>(<FONT face="Times New Roman" 
  size=3>SE_SERVICE_LOGON_NAME) </FONT></FONT><FONT face=Arial size=2>isn't 
  </FONT><FONT face=Arial size=2>defined</FONT></DIV>
  <DIV><FONT face=Arial size=2>anywhere yet.&nbsp; I'll correct both of those 
  problems </FONT><FONT face=Arial size=2>shortly.</FONT></DIV>
  <DIV><FONT face=Arial size=2>For the meantime,&nbsp;you should be able to 
  use</FONT></DIV>
  <DIV><FONT face=Arial size=2>win32security.LsaAddAccountRights( policy_handle, 
  sid_obj, ('SeServiceLogonRight',) )</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; hth </FONT></DIV>
  <DIV><FONT face=Arial size=2>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; 
Roger</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <BLOCKQUOTE dir=ltr 
  style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
    <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
    <DIV 
    style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
    <A title=gustabares@verizon.net href="mailto:gustabares@verizon.net">Gustavo 
    Tabares</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>To:</B> <A title=python-win32@python.org 
    href="mailto:python-win32@python.org">python-win32@python.org</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, April 12, 2005 6:19 
    PM</DIV>
    <DIV style="FONT: 10pt arial"><B>Subject:</B> [python-win32] 
    LsaAddAccountRights help</DIV>
    <DIV><BR></DIV><!-- Converted from text/rtf format -->
    <P><FONT face=Arial size=2>Hello,</FONT> </P>
    <P><FONT face=Arial size=2>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:</FONT> 
    </P>
    <P><FONT face=Arial size=2>#!/usr/bin/env python</FONT> </P>
    <P><FONT face=Arial size=2>import win32security</FONT> </P>
    <P><FONT face=Arial size=2>username = "Administrator"</FONT> <BR><FONT 
    face=Arial size=2>system_name = "temp_system"</FONT> </P>
    <P><FONT face=Arial size=2>policy_handle = 
    win32security.LsaOpenPolicy(system_name, 
    win32security.POLICY_ALL_ACCESS)</FONT> <BR><FONT face=Arial size=2>sid_obj, 
    domain, tmp = win32security.LookupAccountName(system_name, username)</FONT> 
    <BR><FONT face=Arial size=2>win32security.LsaAddAccountRights( 
    policy_handle, sid_obj, win32security.SE_SERVICE )</FONT> <BR><FONT 
    face=Arial size=2>win32security.LsaClose( policy_handle )</FONT> </P><BR>
    <P><FONT face=Arial size=2>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:</FONT></P>
    <P><FONT face=Arial size=2>Traceback (most recent call last):</FONT> 
    <BR><FONT face=Arial size=2>&nbsp; File "C:\example.py", line 12, in 
    ?</FONT> <BR><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; 
    win32security.LsaAddAccountRights( policy_handle, sid_obj, 
    win32security.SE_SERVICE )</FONT> <BR><FONT face=Arial size=2>SystemError: 
    error return without exception set</FONT> </P><BR>
    <P><FONT face=Arial size=2>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.</FONT></P><BR>
    <P><FONT face=Arial size=2>Thanks,</FONT> <BR><FONT face=Arial 
    size=2>Gus</FONT> </P></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>