Run Uninstall Phase before Install

I have been trying to find a solution to run the whole Uninstall phase before the Installation even begins. To be used for software which with new updates don’t update existing installations but instead create new ones.
I was trying to run the Deploy-Application.exe or invoke command deploy-application.ps1 but there doesn’t seem to be any variable for where Deploy-Application.exe is located.
Obviously my workaround is to copy everything from Uninstall Phase, but I wouldn’t say it looks pretty.

Thanks for any help.

I have been doing this very thing for almost 10 years now with PSADT.
I just do it all from inside the same script and use the Pre-Installation phase.
IOW right after this line:
[string]$installPhase = 'Pre-Installation'

We try to remove all previous versions of the software that we have deployed.
This way we can test without SCCM slowing down things.

We do not use SCCM supersedence.

1 Like