Executing Windows administrative shell commands on Windows using Python

Posted by at0m on Server Fault See other posts from Server Fault or by at0m
Published on 2011-07-01T15:58:23Z Indexed on 2011/07/01 16:23 UTC
Read the original article Hit count: 347

I have a batch script using Windows shell commands to perform several administrative actions. The script is running great on Windows 7 but when i try launching it from Python 2.6 nothing happens:

import os
a = os.popen("somebatchfile.bat")

I assume that this is because the bat file uses several commands that require an administrative privileges but i don't want to prompt to a password using runas.exe or embedding the password within the code.

Is there any way to make UAC prompt for user approval or something?

© Server Fault or respective owner

Related posts about windows-7

Related posts about python