Forum Discussion

aniket's avatar
aniket
Occasional Contributor
12 years ago

How to get a exit code from msiexec

I need to install a windows application and for that I am using msiexec command. I created the testedApp for msiexec.exe and I am passing the parameters. Everything works fine but I couldn't get hold of exit code from msiexec command. This is crucial to find out where  install or uninstall is successful. 



The returned object of testedApp.Run() method do not have this info.  The returned object comes as soon as install / uninstall start so logically it will not have that info.



Following is the code snippet




  var TestApp, Params, SimpleParams;

  TestApp = TestedApps.Items("msiexec");

  // Obtains the tested application parameters

  Params = TestApp.Params;

  // Obtains the simple run mode parameters

  SimpleParams = Params.SimpleParams;





  // Modifies the simple run mode parameters:

  SimpleParams.CommandLineParameters = "/i \ <msi file> /qb";

  SimpleParams.Activate();





  // Launches the tested application

  var obj = TestApp.Run();