/build/static/layout/Breadcrumb_cap_w.png

Installation Result Detection and Logic using Wise Script

Hi Guys - I'll try to be as brief/specific as possible, and if there is a better/more efficient way of accomplishing my goal, suggestions are welcome!

Scenario:  We use Wise Package Studio to create our installation procedures, which sometimes include multiple uninstall/install/configurations.  Using these executable files, without customization, it always passes back an exit code of 0 to our deployment tool.

Goal:  Develop a way to cease/desist based on exit code, and/or pass back accurately

Here is a sample of where I'm at, and where I'm stuck on the logic:

If ADBERDRVER Greater Than or Equal "10.1.0.534" then

   Execute %INST%\1013.msp /quiet /norestart /L*V "%LOG%\adberdr1013patch.log" (Wait)

      If INSTALL_RESULT Not Equal "0" then

       If INSTALL_RESULT Not Equal "3010" then

         Set Variable EXITCODE to %INSTALL_RESULT%

         Execute %PATH%\logemailpatch.vbs  (Wait)

      End

      Call DLL %SYS%\kernel32.dll Function ExitProcess

   End

  

ElseIf ADBERDRVER Less Than "10.1.0.534" then

   Execute msiexec.exe /i "%INST%\1010.msi" TRANSFORMS="%INST%\1010.mst" PATCH="%INST%\1013.msp" /quiet /norestart /L*V "%LOG%\adberdr1013.log" (Wait)

      If INSTALL_RESULT Not Equal "0" then

       If INSTALL_RESULT Not Equal "3010" then

         Set Variable EXITCODE to %INSTALL_RESULT%

         Execute %PATH%\logemailfull.vbs  (Wait)

      End

      Call DLL %SYS%\kernel32.dll Function ExitProcess

   End

End

During our testing, we had mixed results of laying the full 10.1.0 MSI and then the patch for 10.1.3 over previous versions, so I elected to detect the file version of acrord32.exe and then take action from there.  (Note:  I realize this is only one example and I'd rather not get in to patch methodology at this point, as this is just an example and can also apply to other .MSI procedures)  The above process works well, but I'd like to do something like this....

Take one approach, IF INSTALL_RESULT is anything except 0 or 3010, perform action X (most likely uninstall).  Then, measure result of the uninstall, if INSTALL_RESULT is 0 or 3010, perform install, then measure result, if install NOT 0 or 3010, pass back, etc.

Only way I can figure I could do this is something like...

INSTALL
IF INSTALL RESULT NOT 0
   IF INSTALL_RESULT NOT 3010
        UNINSTALL
           IF INSTALL_RESULT = 0
              OR (ElseIF?) INSTALL_RESULT=30
                  INSTALL
           Else (not 0 or 3010) pass back to system using kernel32.dll above, and exit installation

Just seems like a mess, so I'm either thinking of this from the wrong direction or making it more complicated. 


0 Comments   [ + ] Show comments

Answers (3)

Posted by: pjgeutjens 12 years ago
Red Belt
2

I hope the code comes out OK in this post, but I would go for something along the lines of:

Set Variable _SUCCESS to FALSE

If INSTALL_RESULT equals "0"

Set Variable _SUCCESS to TRUE

ElseIf INSTALL_RESULT equals "3010"

Set Variable _SUCCESS to TRUE

End

 

If _SUCCESS equals TRUE

...Handle success...

Else

...Handle Failure...

End

 

You can easily add extra exit codes for success


Comments:
  • to clarify, if you want to do the same check again in case of failure, you'd basically use the same structure again where it says ...Handle Failure..., so set success variable to false, execute action, check exit codes and set success, execute if-branch based on value of success variable. Make sure to use a different success variable though, to keep the branches separated. - pjgeutjens 12 years ago
Posted by: akki 12 years ago
4th Degree Black Belt
1

It seemed a bit complicated at first, but I think it`ll work fine if that is what you want.

Same could be achived using a VBScript with more or less same procedure. Also can you tell us what kind of suggestions you were expecting.

Posted by: piyushnasa 12 years ago
Red Belt
1

You can also use Goto command.

I am not sure if there is Case command in BAT.

 
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