Remove App Using Powershell

0

I have the following powershell script, but the result returned is always 1603 even when running with elevated rights, as administrator.

     $app = Get-WmiObject -Class Win32_Product -Filter "Name = 'Microsoft Visio Standard 2013'"

  if ($app) { 
    echo $app
    $app.Uninstall() 
 }

Error returned:

IdentifyingNumber : {90150000-0053-0000-0000-0000000FF1CE}
Name              : Microsoft Visio Standard 2013
Vendor            : Microsoft Corporation
Version           : 15.0.4569.1506
Caption           : Microsoft Visio Standard 2013

__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     : 
__DYNASTY        : __PARAMETERS
__RELPATH        : 
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         : 
__NAMESPACE      : 
__PATH           : 
ReturnValue      : 1603
PSComputerName   : 

Is anyone able to help?

MSI Logs when trying the uninstall string

msiexec.exe /x {90150000-0053-0000-0000-0000000FF1CE} /l*v %temp%\Uninstall.Log /qn /norestart

MSI (s) (18:E4) [16:35:25:521]: Windows Installer removed the product. Product Name: Microsoft Visio Standard 2013. Product Version: 15.0.4569.1506. Product Language: 0. Manufacturer: Microsoft Corporation. Removal success or error status: 1603.

MSI (s) (18:E4) [16:35:25:521]: Attempting to delete file C:\Windows\Installer\7c8008.mst MSI (s) (18:E4) [16:35:25:526]: Deferring clean up of packages/files, if any exist MSI (s) (18:E4) [16:35:25:526]: Attempting to delete file C:\Windows\Installer\7c8008.mst MSI (s) (18:E4) [16:35:25:527]: Unable to delete the file outside of the engine. LastError = 2 MSI (s) (18:E4) [16:35:25:527]: MainEngineThread is returning 1603 MSI (s) (18:50) [16:35:25:530]: RESTART MANAGER: Session closed. MSI (s) (18:50) [16:35:25:530]: No System Restore sequence number for this installation. === Logging stopped: 28/01/2019 16:35:25 === MSI (s) (18:50) [16:35:25:532]: User policy value 'DisableRollback' is 0 MSI (s) (18:50) [16:35:25:532]: Machine policy value 'DisableRollback' is 0 MSI (s) (18:50) [16:35:25:532]: Incrementing counter to disable shutdown. Counter after increment: 0 MSI (s) (18:50) [16:35:25:532]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 MSI (s) (18:50) [16:35:25:532]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2 MSI (s) (18:50) [16:35:25:532]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1 MSI (s) (18:50) [16:35:25:533]: Destroying RemoteAPI object. MSI (s) (18:78) [16:35:25:533]: Custom Action Manager thread ending. MSI (c) (58:B0) [16:35:25:536]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1 MSI (c) (58:B0) [16:35:25:536]: MainEngineThread is returning 1603 === Verbose logging stopped: 28/01/2019 16:35:25 ===

RLBChrisBriant

Posted 2019-01-15T16:46:28.957

Reputation: 19

That's no error, that is the output of Write-Output $app (echo is just an alias for that cmdlet). IS the app uninstalled? – LotPings – 2019-01-15T17:15:01.433

Sorry, I understand what you mean. It isn't an error as such. I meant that the value of 1603 returned from the Uninstall method is indicating that the program is not uninstalling. No, it doesn't uninstall. – RLBChrisBriant – 2019-01-16T09:18:12.833

1That exit code is unfortunately a generic MSI failure code. The official MSI documentation states that 1603 translates to "A fatal error occurred during installation." Run the MSI uninstall manually with a verbose logging and it should give you clues as to why its failing. (Command: msiexec.exe /x {90150000-0053-0000-0000-0000000FF1CE} /l*v %temp%\Uninstall.Log /qn /norestart) If you need help, post the log and we can help. – Paul G – 2019-01-28T02:14:25.270

Hi, with this command, it still remains on the system, but i have the logs. I will update the main question with the MSI log. – RLBChrisBriant – 2019-01-28T16:52:27.883

[16:35:25:527]: Unable to delete the file outside of the engine. LastError = 2 MSI (s) (18:E4) This is the failing statement. Could you check if the file C:\Windows\Installer\7c8008.mst is still present on your system, or if the permissions are messed up? – Ultrasonic54321 – 2019-01-28T17:00:29.160

Hi, 7c8008.mst is not present on the system. – RLBChrisBriant – 2019-01-29T10:16:12.297

We get the same issue with MS Project as well. They both have transforms, but the uninstall string is unable to remove them. – RLBChrisBriant – 2019-01-30T17:08:08.240

No answers