[python-win32] How to launch an executable in elevated mode on Vista with UAC on?

Mark Hammond skippy.hammond at gmail.com
Tue Mar 3 03:01:34 CET 2009


On 3/03/2009 12:10 PM, Patrick Li wrote:
> Hello,
>
> I have a python program that needs to launch an executable (it is an
> installer executable) that requires admin privileges.  This works fine
> on XP and Vista machines where UAC is turned off.  On Vista machines
> with UAC on, however, it doesn't appear to allow the program to launch
> the executable.
>
> I currently use win32process.CreateProcess() to launch the executable.
>
> Does anyone know of a way I can launch the executable with UAC on?
>   Ideally, it should prompt the user to run the executable in elevated mode.
>
> Any help would be greatly appreciated.

The only way I'm aware of is to use ShellExecute[Ex] with the 'runas' verb.

Cheers,

Mark


More information about the python-win32 mailing list