Aramanethota
Aramanethota

Reputation: 693

How to install a msi using python script?

Is there any python script to install a msi? I need to install msi and run it without showing any dialogue modal. I have msi on my folder c:\user\documents and i have a wxpython GUI developed using python script.I need to silent install msi and run the exe from the GUI.

Upvotes: 3

Views: 14659

Answers (2)

Rich Tier
Rich Tier

Reputation: 9441

simple use. No transforms provided, and code is non-blocking:

import os
os.system('msiexec /i %s /qn' % msi_location)

With transforms, and code is non-blocking:

import os
os.system('msiexec /i %s TRANSFORMS=%s /qn' % (msi_location, transforms_location)

With transforms, and code is blocking - so you know when it has completed:

import subprocess
subprocess.call('msiexec /i %s TRANSFORMS=%s /qn' % (msi_location, transforms_location), shell=True)

For more info on TRANSFORMS: https://msdn.microsoft.com/en-us/library/aa367447%28v=vs.85%29.aspx

Upvotes: 9

Doc Brown
Doc Brown

Reputation: 20044

This is not really a python question, and it depends if your specific MSI package allow unattended installation. See this SO article

detect msi parameters for unattended install

how to find out about the parameters of an MSI package. Then, try the unattended installation manually using the windows command shell, calling msiexec. See here

http://technet.microsoft.com/en-us/library/cc759262%28v=ws.10%29.aspx

for more information.

Finally, all you need to do in python is to use os.system to call msiexec with the name of the package and the correct parameters.

Upvotes: 2

Related Questions