Running a program as another user on Win32

Toby Dickenson htrd90 at zepler.org
Thu Nov 11 23:39:24 CET 1999


"Mark Hammond" <mhammond at skippinet.com.au> wrote:

>emuller at painewebber.com wrote in message <809ea4$ln$1 at nnrp1.deja.com>...
>>I am writing a bunch of scripts that will need to run as Administrator
>>(Domain Administrator) on Windows NT 4.0 workstation clients that
>>belong to an NT domain. I've tried using LogonUser, but I always get
>>the following: pywintypes.api_error: (1314, 'LogonUser', ' A required
>>privilege is not held by the client.'). I've also tried using LogonUser
>>with the local Administrator account on my NT machine with no luck.
>
>You need to explicitely enable the privilege.

....

LogonUser should enable any priviledges not held by the process as
required. However you do need to grant the priviledge to the user who
will be running your script; "Act as part of the operating system" in
this case.

Yes, even Administrators do not have this priviledge by default. The
System account does, so your existing script should work if it's
running as a service.

hope this helps,


Toby Dickenson




More information about the Python-list mailing list