2 Replies Latest reply on Feb 26, 2018 1:19 PM by SitzRieSe

    deploying software, can I detect if it exists before the install

    JHammo Apprentice

        I'm new to using DSM netinstall, I want to be able to detect if the product exists on the machine before trying to install it.  what is the best method to do this?  Do I need to write me own escript pre-execution script and write the conditions to check for?

       

      whats the best method?

       

      Jason

        • 1. Re: deploying software, can I detect if it exists before the install
          _Mel_ Master

          ich the check is not too complicated (e.g. checking if an executable exists) you can set the preinstalled condition ("Condition for existing installation") of the packet - if this condition is met a package that wasn't executed before and isn't already installed will be set to installed.

          This has the advantage that the package will not be downloaded into the cache.

           

          if you can't do the check in this way you have to check it in the script - but remember to do this only if the execution mode is install or you will prevent reinstallations

          • 2. Re: deploying software, can I detect if it exists before the install
            SitzRieSe Expert

            I would like to recommend to check the registry. You will find all software installation in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. This is the part which you can see in the program library of the control panel of windows too.

            There you have the possibilty to check for the program version if you create a if request for the DisplayVersion value. In the current dsm release you will find a regsearch command. If you using this you can let it searching for the software, because on every key you will find the DisplayName value. So if you know that key is different to the program version, you can use regsearch and put the output in a variable and make a check for the existing or for a special version. In my opinion the best way to do, because its for all application the same way.

             

            Here is an example for greenshot:

             

            !==============================================

            !Pre Installation Check

            !

            Set('DisplayVersionValue','1.2.10.6')

            Set('RegKey','Greenshot_is1')

            !

            !==============================================

            Set('CheckAllowed','0')

            !

            If not CheckInstallMode(imReinstall)

            Set('CheckAllowed','1')

            !

            If CheckInstallMode(imUpdate)

            Set('CheckAllowed','1')

            !

            If CheckInstallMode(imUninstall)

            Set('CheckAllowed','0')

            !

            ! === Enable for x64 Check

            If %CheckAllowed%='1'

            RegReadValueEx('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%RegKey%','DisplayVersion','ProgVersion',reUseX64Hive)

            If %ProgVersion%='%DisplayVersionValue%'

              ExitProcEx(Done,'%CurrentPackage.Object.Name% was already installed!')

             

            Im using this in the escript, but you can do this in the properties of the package too. I know in my case the package will be staged, but thats no problem in my case and i like to have it in the escript. its more clearly arranged.

             

            regards

             

            Alex