Install MSI packages (Locally and on Remote computers) using WMI

Posted on Updated on

Installing of packages and msi is a day to day activity in current business scenario. And with growing use of technology and programs it becomes all the more important to have this process efficient, error free, less time consuming. Automating such process becomes all the more important.

Today we will see how we can achieve the same. WMI comes with great feature to leverage it and automate our msi installation process.

WMI namespace — root\CIMV2 has a class – “Win32_Product” which has few methods that work on msi packages. The methods being: —Admin, —Advertise, —Configure, —Reinstall, —Install, —Uninstall,–Upgrade

We will take a look at the Install method to achieve our goal. We can use WMI for automated installation either on a single machine, locally or on a group of machines.

Image

Doing a local computer Installation can be done straight forward with the package location assigned to inParams.

The key here for remote multi machine installation is the “CopyToTempLocation” method that copies the msi from the machine on which the program is running to a local location on the specified remote machine and the new path is then set to inParams.

The outParams[ReturnValue] return the code .i.e the result of execution. There is a comprehensive list of codes returned and the one we should be looking for is  Zero“0” which implies success.

Please visit http://support.microsoft.com/kb/304888 to see the list of codes returned.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s