Scripting Question

Ho To get exit code from VBS custom action and abort MSI installation if does not meet requirement

01/26/2017 1118 views

I have problem statement in which I have to check that if MS office excel is running then give three prompt messages to users to close it and  if still excel is running then I have to abort the installation and give failure message.

Please advise

0 Comments   [ + ] Show comments


Community Chosen Answer

If you use AdminStudio: 
1) In AdminStudio create VB custom action. Select function you want to use from VBScript body. 
2) In AdminStudio set "check exit code" parameter for custom action you created.
3) Return non zero exit code in your VBScript function in the case if you see unessasary applications are runing.  

In this case MSI will fail if your custom action returns non zero exit code. And don't forget to set correct sequence for CA. 
Answered 01/26/2017 by: itolutions
Purple Belt

  • You can do the same in any MSI editor (not only AdminStudio), but it will be more comlicated to look at requred parameters in MSDN

All Answers

Putting on my clairvoyance hat, here goes!

  • Enterprise environment.
  • No reboots
  • No pop ups
You have mentioned that you would like pop ups to notify the user, but Im still going to presume a enterprise environment. If this is the case then you should consider using PS App Deployment Toolkit, it does a nice job and popping up and deferring, it also integrates well with SCCM. This would also save you the returning a failure in the MSI thus causing SCCM and your reports some grief.

Applying my clairvoyance hat more and you are authoring this MSI, the FileInUse should take care of that for you and copy the file into place on reboot. If you really don't want this to happen then you would need a VBS script, of which slightly complex as you would like it to prompt 3 times - I would use inbuilt dialogs to prompt, I cant write VBS so cant help here.

If you are adding a Excel Add-on, you should be using a different method as there is a registry key ordering that needs to be taken into account.

Clairvoyance hat off (:

Good luck!
Answered 01/26/2017 by: rileyz
Red Belt

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ