This is a really simple script that just uninstalls an application. Here is my code:
$app = Get-WmiObject -Class Win32_Product -Filter "Name = 'Alliance Suite G5'"
Write-Host $app
$app.Uninstall()
I put the Write-Host in just to make sure it was grabbing the correct application. Here is my output.
\COMPUTERNAME\root\cimv2:Win32_Product.IdentifyingNumber="{99B66721-7E75-487C-A0C8-A4F8C4325661}",Name="Alliance Suite G5",Version="2013.2.14226.1"
__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ReturnValue : 0
PSComputerName :
The return value is 0, but it never actually uninstalls the application. Any help would be appreciated! I run some automated tests at night and one of them installs the application so it would be nice if I could make a scheduled powershell script to uninstall it.
Event Viewer (NOTE: The product is "reconfigured several times before the second message):
Windows Installer reconfigured the product. Product Name: Microsoft Identity Extensions. Product Version: 2.0.1459.0. Product Language: 1033. Manufacturer: Microsoft Corporation. Reconfiguration success or error status: 0.
Beginning a Windows Installer transaction: {99B66721-7E75-487C-A0C8-A4F8C4325661}. Client Process Id: 8664.
Product: Alliance Suite G5 -- Removal completed successfully.
Windows Installer removed the product. Product Name: Alliance Suite G5. Product Version: 2013.2.14226.1. Product Language: 1033. Manufacturer: United Systems & Software. Removal success or error status: 0.
Result when running command:
C:\Windows\system32>msiexec.exe /X "C:\AllianceInstall\G5\Alliance.G5.exe" /QN /
L*V "C:\msilog.log
=== Verbose logging started: 8/18/2014 9:42:06 Build type: SHIP UNICODE 5.00.9200.00 Calling process: C:\Windows\system32\msiexec.exe === MSI (c) (5C:74)
[09:42:06:039]: Resetting cached policy values MSI (c) (5C:74)
[09:42:06:039]: Machine policy value 'Debug' is 0 MSI (c) (5C:74) [09:42:06:039]: * RunEngine: * Product: C:\AllianceInstall\G5\Alliance.G5.exe * Action: * CommandLine: ****** MSI (c) (5C:74)
[09:42:06:039]: Client-side and >UI is none or basic: Running entire
install on the server. MSI (c) (5C:74)
[09:42:06:039]: Grabbed execution mutex. MSI (c) (5C:74)
[09:42:06:061]: Cloaking enabled. MSI(c) (5C:74)
[09:42:06:061]: Attempting to enable all disabled privileges before calling Install on Server MSI (c) (5C:74)
[09:42:06:064]: Incrementing counter to disable shutdown. Counter
after increment: 0 MSI (s) (F8:48) [09:42:06:069]: Running installation inside multi-package transaction C:\AllianceInstall\G5\Alliance.G5.exe MSI (s) (F8:48) [09:42:06:069]: Grabbed execution mutex. MSI (s) (F8:64)
[09:42:06:071]: Resetting cached policy values MSI (s) (F8:64) [09:42:06:071]: Machine policy value 'Debug' is 0 MSI (s) (F8:64) [09:42:06:071]: * RunEngine:
******* Product: C:\AllianceInstall\G5\Alliance.G5.exe ******* Action: ******* CommandLine: ********** MSI (s) (F8:64)
[09:42:06:072]: Note: 1: 2203 2: C:\AllianceInstall\G5\Alliance.G5.exe
3: -2147286960 MSI (s) (F8:64)
[09:42:06:073]: MainEngineThread is
returning 1620 MSI (s) (F8:48)
[09:42:06:074]: User policy value
'DisableRollback' is 0 MSI (s) (F8:48)
[09:42:06:074]: Machine policy
value 'DisableRollback' is 0 MSI (s) (F8:48)
[09:42:06:074]:
Incrementing counter to disable shutdown. Counter after increment: 0 MSI (s) (F8:48)
[09:42:06:074]: Note: 1: 1402 2:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 MSI (s) (F8:48)
[09:42:06:074]: Note: 1: 1402 2:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 MSI (s) (F8:48)
[09:42:06:075]: Decrementing counter to disable
shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1 MSI (c) (5C:74)
[09:42:06:076]: Decrementing counter to
disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1 MSI (c) (5C:74)
[09:42:06:076]: MainEngineThread
is returning 1620
=== Verbose logging stopped: 8/18/2014 9:42:06 ===