<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>LsaAddAccountRights help</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2604" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2> 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. 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. 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, 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> </DIV>
<DIV><FONT face=Arial size=2> hth </FONT></DIV>
<DIV><FONT face=Arial size=2> Roger</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </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> File "C:\example.py", line 12, in ?</FONT> <BR><FONT
face=Arial size=2> 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></BODY></HTML>