Run a component only during first installation


I'm sorry if I am on the wrong section and sorry for my English.

I'm using Installshield 2016 and creating a msi. 

My situation:

I've created a component which add a file .cer in the INSTALLDIR in order to install it in trusted authority. To do this, I have a custom action played during Installation. At the end of the Execute Sequence I delete the certificat by using an other custom action.

My problem: When I do a repair in user mode (no admin rights), the certificat is added again but cannot be deleted because users don't have rights to suppress files in C:.

So I wonder if there is a possibility to use a condition so my component can be played ONLY during first Install.

Thanks for your help.

0 Comments   [ + ] Show comments

Answers (4)

Answer Summary:
Posted by: kitco 2 years ago
White Belt

Use following condition for the custom action:
NOT Installed

The condition checks if it is already installed.
This allows to run only on the first installation


...my english is not better ;-)

  • Thank you.

    The custom action is already setted as NOT Installed. I am not sure that the solution is here.
    I would like to set a condition on the component. - oussou75 2 years ago
    • What software is it?
      You can send me an email. - kitco 2 years ago
      • AppGate 4.1.0.
        Could you give me your address? - oussou75 2 years ago
      • attila.kiss@kitco.ch - kitco 2 years ago
Posted by: rad33k 2 years ago
Fourth Degree Brown Belt

Top Answer

As kitco mentioned - "NOT Installed" condition is one of the solutions.
In the InstallShield you can also add the .CER file to "Support Files" and call it using [SUPPORTDIR] property.
"... Support files are files that are available on the target system only during your product’s installation process...."

If you prefer a way with conditions,  you would need to use "NOT Installed" as a condition for the Custom Actions and for the component with .CER file. Additionally you have to include Transitive attribute (0x0040) for the corresponding component so the condition is re-evaluated on repair (then component with .cer file won't be recreated on repair).

Another option is to use Transitive attribute (0x0040) together with AdminUser property as a component's condition. Then your component (and .cer file) will be installed ONLY when installation/repair is triggered by a user with administrator privileges.
I'm talking about something like this:

Posted by: kitco 2 years ago
White Belt

rad33k's answer is absolutely correct.
But why not "Keep it simple and stupid"?

With this way you can use the original vendor installer.

Powershell as Example:

  Install/Uninstall AppGate per Powershell
  EXE and script(IU_AppGateSDP.ps1) must be located in same directory
  powershell -ExecutionPolicy Bypass -file IU_AppGateSDP.ps1 install
  powershell -ExecutionPolicy Bypass -file IU_AppGateSDP.ps1 uninstall

    $Action = "Install"  

    "Install" {
        Start-Process (gci -Path .\ -File -Filter "AppGate*.exe").Name-ArgumentList "/S/M /G" -Wait
    "Uninstall" {
        Start-Process "${env:ProgramFiles(x86)}\AppGateSDP\driver\Uninstaller.exe" -ArgumentList"/S" -Wait
        Start-Process "${env:ProgramFiles(x86)}\AppGateSDP\Uninstaller.exe" -ArgumentList "/S" -Wait
        Remove-Item Cert:\LocalMachine\TrustedPublisher\D6B9C0A13537D0100F693DC2EBFC777EDBADB113-Force

You can start it with powershell -ExecutionPolicy Bypass -file IU_AppGateSDP.ps1 (un-)install

Posted by: oussou75 2 years ago
White Belt
Thank you guys!

I used the Support Files (I didn't know the purpose of it) and it worked fine. But I noticed that the support file is called in repair mode also (not a problem since the certificat deleted itself).

To answer kitco, the client requires a msi, that's why I used repackager.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


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