Run a component only during first installation
Answers (4)
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
greetz
...my english is not better ;-)
Comments:
-
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 5 years ago
Top Answer
"... Support files are files that are available on the target system only during your product’s installation process...."
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.
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:
<#
.Synopsis
Install/Uninstall AppGate per Powershell
.DESCRIPTION
EXE and script(IU_AppGateSDP.ps1) must be located in same directory
.EXAMPLE
powershell -ExecutionPolicy Bypass -file IU_AppGateSDP.ps1 install
.EXAMPLE
powershell -ExecutionPolicy Bypass -file IU_AppGateSDP.ps1 uninstall
#>
[CmdletBinding()]
Param
(
[Parameter()]
[ValidateSet("Install","Uninstall")]
$Action = "Install"
)
switch($Action)
{
"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