Remove App Using Powershell

Remove App Using Powershell

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 ===

7
James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.