WMI: How to Install MSI packages on Local and Remote computers

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

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

WMI namespace — root\CIMV2 has a class – “Win32_Product” which has a 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.

http://biztalkbox.files.wordpress.com/2014/04/untitled1.png

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.

See Also

Another important place to find a huge amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk Server Resources on the TechNet Wiki.