Summary of situation
I have some third party extension software for ArcGIS that I need to be able to uninstall with a powershell script. I have successfully installed and uninstalled a suite of software using the AppDeployToolkit for powershell but I am stuck trying to uninstall this one program. I am able to uninstall everything by running the MSI with an "Uninstall parameter". Unfortunately, this third party extension has no uninstall/remove option in the msi (no repair, remove, or uninstall options when I run it manually). It simply just tries to install again. I am, however, able to successfully uninstall from the 'Apps and Features' program GUI tool in windows.
Here are the things i've tried:
attempt A: Using the AppDeployToolkit
Execute-MSI -Action "Uninstall" -Path "Path\To\ArcFM.msi"
Output: Error: Application is already installed
attempt B: using WMI Object
$app = get-wmiobject -class win32_product |where-object {$_.Name -Match "ArcFM Solution Desktop*"}
$app.Uninstall()
Output: 1603
error (this is the error code for an installation error)
attempt C: using Uninstall-Package
$app = get-package -provider programs -includewindowsinstaller -name "ArcFM*
Uninstall-Package -Name $app
Output: Asks me to automatically install Microsoft.PackageManagement.NuGetProvider-2.8.5.208.dll
. When I enter Y
to automatically install I get this error...
Uninstall-Package : No package found for 'Microsoft.PackageManagement.Packaging.SoftwareIdentity'.
At line:1 char:1
+ Uninstall-Package -Name $arcfm2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package], Exception
+ FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage
My Question
My overall questions is "How can I uninstall this software from powershell?"
But more specifically....
I CAN uninstall it from 'Apps and Feautures'. So when I use the GUI to do that, how exactly is windows executing the uninstall? It's not using the MSI and apparently not using wmi-objects either. It can't be using Uninstall-Package because it's not even installed on the machine. Is there a way for me to execute the same process that add/remove programs executes to uninstall from powershell? Is there a different way to uninstall software that I have missed?