views:

39

answers:

2

is it possible to write a script in python that installs an msi? or is it possible to to make it through any other script?

+2  A: 

You can use the antiquated os.system('msiexec /i whatever.msi'), or, better, the subprocess equivalent subprocess.call -- in either case, you can also add whatever further msiexec flags or arguments you desire (documentation in abundance here).

Alex Martelli
Oh noes alex! Don't be suggesting someone use `os.system`! Seriously, go to `subprocess`, please.
Nick Bastin
@Nick, OK, edited to clarify subprocess's preferred status.
Alex Martelli
The Learner
@The Learner: `os.system` is a fire-and-forget solution to running another process in a subshell. However, you can't control it in any way, you can't get access to its' `stdout/stderr`, you can't control the shell used on windows, and `subprocess` provides a lot of additional functionality that is very useful for process communication and management.
Nick Bastin
A: 

AFAIK, it's possible to use WMI in Python, so you should be able to install MSI files using the Win32_Product.Install method.

Helen
@Helenim a complete newbie in scripting..so, what way should i prefer? os.system/subprocess or the WMI ?pls advicethanks..
The Learner
@The Learner: I have no idea; I don't know Python myself (unfortunately). But in VBScript and PowerShell scripting, WMI is pretty handy for this kind of task.
Helen