简体   繁体   中英

Trying to uninstall a program with wmic and getting error 1603

I'm try to create a batch file that will, among other things like installing the newest version of our software, first UNINSTALL the old version. I have used "wmic product get name" to find the actual name of the program, and then I have scripted the following code to uninstall the program:

wmic product where "name like 'Borland CaliberRM 10.1'" call uninstall /nointeractive >> C:\users\pbrandvold\Desktop\log.txt

When it's finished, I get this message:

Executing (\\PHIL-BRANDVOLD\ROOT\CIMV2:Win32_Product.IdentifyingNumber="{ED8B0A1F-8E90-478A-82B6-7C885A628257}",Name="Borland CaliberRM 10.1",Version="10.1.0.84")->Uninstall()

Method execution successful.

Out Parameters:
instance of __PARAMETERS
{
    ReturnValue = 1603;
};

I can't think of what is happening - why won't this uninstall? I've also tried using the msi, and running:

msiexec.exe /qn /x "Borland CaliberRM 10.1.msi"

Which doesn't work either.

I had this issue when trying to uninstall and reinstall Web Deploy using wmic via a batch file. It did not help running the batch file with elevated privileges.

The only way I could get it to run correctly was to open a Command Prompt window with elevated privileges and run the batch file through that.

The solution I ended up going with was to turn my batch file into an executable using a Bat to Exe converter. http://www.f2ko.de/en/b2e.php

The issue occurs due to the user's privileged of uninstalling the program. Just open the command prompt as 'Run as administrator and run your command to uninstall the program. Example: open cmd with admin: run below commands

  1. wmic
  2. product get name
  3. product where name="YOUR_PROGRAM_NAME" call uninstall

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM