Problem with uninstall

Hello all,

I’m new to PsAppDeployToolKit and I love it!

I have a small question because I have a big problem :slight_smile:

I made a script that installs an MSI file and writes to the registry. It all works very well!

I wanted to add a line for uninstallation in the UNINSTALLATION part:
Start-Process msiexec.exe -Argument “/x {XXXXX}”
And in post uninstallation deleting registry keys:
Remove-Item -Path “HKLM:\Software\XXXX” -Name “XXX”

Now when I run the install it also does the uninstall.

I run the installation using the following command:
Deploy-Application.exe -DeploymentType “Install” -DeployMode “Silent”

And the uninstallation by the command:
Deploy-Application.exe -DeploymentType “Install”

Do you have any ideas why it also does the uninstallation at the same time as the installation? And why it doesn’t delete registry keys while the command works if I do it manually?

Thanks for your help :wink:

You likely deleted a bracket somewhere which is causing the functions to merge into one.

As for the installation\uninstallation I would suggest using the bultin commands in effort to make full use of the toolkit - Execute-MSIRemove-MSIApplications

To initiate the install phase of the script I personally run
Deploy-Application.exe -DeploymentType “Install” -DeployMode “Silent”

As for the uninstallation -
Deploy-Application.exe -DeploymentType “UnInstall” -DeployMode “Silent”

Otherwise, try starting with a fresh copy of the toolkit template and paste your code back in paying attention to the brackets.

Best of luck to you!

Start-Process msiexec.exe -Argument “/x {XXXXX}” -Wait