Forum Discussion

aniket's avatar
aniket
Occasional Contributor
14 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();





3 Replies

  • aniket's avatar
    aniket
    Occasional Contributor
    I havent tried this approch, but will it work with msiexec?



    I am using msexec for silent uninstall and install for windows app.



    -Aniket
  • Anonymous's avatar
    Anonymous

    Hi Aniket,



    That should work for any apps. Give it a try.



    P.S. Let us know your results.