cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Vishalsa
Level 4

UnInstall does not work through powershell

Jump to solution

Hi All,

 

I am using a PowerShell custom action, in the custom action I have written command to uninstall other apps and I am running this script only on uninstall.

1. The script is working fine. Tested standalone. and when put in package it does execute other cmdlets.

2. It is also running only on uninstall.REMOVE="ALL"

However, it seems to skip the uninstallation command only.

only the part where we define to uninstall any package through MSIEXEC /X PRODUCTCODE or uninstall-package PACKAGENAME does not work.

 

Any suggestions or anything I missed.

 

 

0 Kudos
(1) Solution

Try to put your PS1 CA as:

========================

Return processing: Asynchronous  (waits for exit code)

In-Script exec: Commit execution in system context

=====

Install exec seq.: After schedule reboot ( before InstallFinalize )

Condition: REMOVE="ALL"

=========================================

PS1, CA to uninstall two apps:

## App1

$startParams = @{
'FilePath' = 'msiexec.exe'
'ArgumentList' = '/x {AD2E87E4-5108-4253-B2C3-9F48A27A8D39}', '/qb'
'Wait' = $false
'PassThru' = $true
}
$proc = Start-Process @startParams

start-sleep 1

## App 2

$startParams = @{
'FilePath' = 'msiexec.exe'
'ArgumentList' = '/x {AD2E87E4-5108-4253-B2C3-9F48A27A8DFF}', '/qb'
'Wait' = $false
'PassThru' = $true
}
$proc = Start-Process @startParams

start-sleep 1

 

 

View solution in original post

(5) Replies
roman2
Level 7

 

One other  way to uninstall another MSI is to call a CA:
==================================================
CA Name: caUNinstallMSI
Type: New exe/Path referencing a directory
=====
Working directory:           SystemFolder
File name & command: msiexec.exe /x {GUIDTOBEUNINSTALL} /qn
Return processing:         Asynchronous, no wait for completion
In-Script exec:                  Commit execution in system context
MSI-Type number:         3810
=====
Install exec seq.:            After schedule reboot ( before InstallFinalize )
Condition:                       REMOVE="ALL"

0 Kudos
Thanks @roman2,

I have more than 10 applications to uninstall .
and for different version/basically GUID will be changed time to time.

so i am trying to uninstall the application using name.

hence i am using powershell. but the problem is i know i am not missing the command like where i can split or how i can split the command line so powershell can take it as whole command
0 Kudos

Try to put your PS1 CA as:

========================

Return processing: Asynchronous  (waits for exit code)

In-Script exec: Commit execution in system context

=====

Install exec seq.: After schedule reboot ( before InstallFinalize )

Condition: REMOVE="ALL"

=========================================

PS1, CA to uninstall two apps:

## App1

$startParams = @{
'FilePath' = 'msiexec.exe'
'ArgumentList' = '/x {AD2E87E4-5108-4253-B2C3-9F48A27A8D39}', '/qb'
'Wait' = $false
'PassThru' = $true
}
$proc = Start-Process @startParams

start-sleep 1

## App 2

$startParams = @{
'FilePath' = 'msiexec.exe'
'ArgumentList' = '/x {AD2E87E4-5108-4253-B2C3-9F48A27A8DFF}', '/qb'
'Wait' = $false
'PassThru' = $true
}
$proc = Start-Process @startParams

start-sleep 1

 

 

Hi @roman2,

I tried above mentioned steps and was getting an error "another program is being run........"
so i modified some settings.
1. Asynchronous (No waits for exit code)
in my script i have placed sleep for 4 minutes.
so current MSI gets uninstalled without any error then after rest of the MSI uninstallation commands starts and this is working.
0 Kudos

Hello Vishalsa,

I am happy, it does work.

Thanks for the kudo!

I would like you to ask you to send me a screenshot of your configured PS1 custom action.
I mean this one:

[cid:image001.jpg@01D5E307.C46642D0]
What version of IS ( what SP ?) are you using?

0 Kudos