cancel
Showing results for 
Search instead for 
Did you mean: 
herbertkoelman
Active participant

Execute powershell action only when installing (not when uninstalling)

I run a powershell script when installing my stuff.

Is there a way to tell InstallShield 2018 not to run the script when uninstalling ?

Or maybe there is a property I can test to avoid execution of the commandlets of my powershell script.

Labels (1)
0 Kudos
5 Replies
Roman2
Active participant

Re: Execute powershell action only when installing (not when uninstalling)

Set condition to Custom Action "Not Installed"

 

 

herbertkoelman
Active participant

Re: Execute powershell action only when installing (not when uninstalling)

Ok, and is there a way to test a property in the powershell that would make it possible to write something like .

$action = Get-Property -name <some property>
switch ( $action){
  Installing
  {
    # do something to install my stuff
  }
  Uninstalling
  {
    # do something to uninstall my stuf
  }
  Patch
  {
    # do something whe patching
  }
}
0 Kudos
Roman2
Active participant

Re: Execute powershell action only when installing (not when uninstalling)

 

Look at Installer Property

Property

Patch, Installed, REMOVE

0 Kudos
herbertkoelman
Active participant

Re: Execute powershell action only when installing (not when uninstalling)

If I understand this well, I could write something like
if (Get-Property -name REMOVE){
# we are uninstalling
} elif (Get-Property -name REMOVE) {
# we are upgrading
} else {
# we are installing (from scratch)
}
0 Kudos
Highlighted
Roman2
Active participant

Re: Execute powershell action only when installing (not when uninstalling)

Hello,

REMOVE -> uninstallation

Not REMOVE And Installed -> it could be update (? please check it on test system)

Not Installed -> new installation

Regards

Roman

 

 

 

0 Kudos