ameett
10 years agoContributor
Install and Uninstall an application through the script.
How to Install and Uninstall an application through the script?........for eg. A .msi application. I am using C# script. Thanks ameett
- 10 years ago
If you need to just silently install the MSI file, and not test the installer, you can use the Win32_Product.Install method:
var strMSIPath = "C:\\MyAppSetup.msi"; var strOptions = ""; // MSI properties in the format "PROPERTY1=value1 PROPERTY2=value2" var ForAllUsers = false; var oSoftware = GetObject("winmgmts:").Get("Win32_Product"); var res = oSoftware.Install(strMSIPath, strOptions, ForAllUsers); if (res != 0) Log.Error("Could not install the MSI file. Error " + res);
// For error codes, see MSDN: // https://msdn.microsoft.com/en-us/library/aa390890(v=vs.85).aspxTo uninstall an application, try this example: Uninstall an application.
Use the application name as shown in Programs and Features.