[windows-7] How to Create a script via batch file that will uninstall a program if it was installed on windows 7 64-bit or 32-bit

I am in a small bind. The program in question can be installed in the program files directory (64bit) or X86 path. The program is already installed in over 200 machines. I am fairly certain the default install path was X86 as that's the default. I am not certain and must cover both scenarios. The original sys admin that installed this didn't use an .msi so I'm left with what I've found as ""C:\Program Files\InstallShield Installation Information{78AC336D-25F6-4916-A711-2EA2F69E0319}\setup.exe" as the command provided by one utility to remotely uninstall said application I found. Didn't work and I cannot attempt to push this out in hopes it'll work.

Given this problem, is there a way to uninstall this program via a script that would check both program files and X86 paths and uninstall depending on location? OR, is there a script that will just flat out uninstall the program regardless without the concern for the X86/program original install location. I just need to uninstall it period across all of these machines. The install .bat is good to go. What I cannot do is just get window to uninstall X application via a script for 32 or 64 bit machines.

I've tried MsiExec.exe /X{78AC336D-25F6-4916-A711-2EA2F69E0319} /quiet with no go. I can try to install the .msi this time around but am lost and my knowledge is limited with scripting or any uninstall scripts for telling "end users" without confusing them to just click here. I could tell them to go to control panel, etc..but they'll be lost....typical.

Any ideas on how to script this uninstall given it wasn't an original .msi and I am not sure how to get something working? I'm open to anything. I have two days to get this fixed and I'm in panic mode...

Any ideas or help on code would be greatly appreciated.

Regards, Brian

This question is related to windows-7 batch-file windows-xp uninstallation

The answer is


wmic can call an uninstaller. I haven't tried this, but I think it might work.

wmic /node:computername /user:adminuser /password:password product where name="name of application" call uninstall

If you don't know exactly what the program calls itself, do

wmic product get name | sort

and look for it. You can also uninstall using SQL-ish wildcards.

wmic /node:computername /user:adminuser /password:password product where "name like '%j2se%'" call uninstall

... for example would perform a case-insensitive search for *j2se* and uninstall "J2SE Runtime Environment 5.0 Update 12". (Note that in the example above, %j2se% is not an environment variable, but simply the word "j2se" with a SQL-ish wildcard on each end. If your search string could conflict with an environment or script variable, use double percents to specify literal percent signs, like %%j2se%%.)

If wmic prompts for y/n confirmation before completing the uninstall, try this:

echo y | wmic /node:computername /user:adminuser /password:password product where name="whatever" call uninstall

... to pass a y to it before it even asks.

I haven't tested this, but it's worth a shot anyway. If it works on one computer, then you can just loop through a text file containing all the computer names within your organization using a for loop, or put it in a domain policy logon script.


Assuming you're dealing with Windows 7 x64 and something that was previously installed with some sort of an installer, you can open regedit and search the keys under

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

(which references 32-bit programs) for part of the name of the program, or

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

(if it actually was a 64-bit program).

If you find something that matches your program in one of those, the contents of UninstallString in that key usually give you the exact command you are looking for (that you can run in a script).

If you don't find anything relevant in those registry locations, then it may have been "installed" by unzipping a file. Because you mentioned removing it by the Control Panel, I gather this likely isn't then case; if it's in the list of programs there, it should be in one of the registry keys I mentioned.

Then in a .bat script you can do

if exist "c:\program files\whatever\program.exe" (place UninstallString contents here)
if exist "c:\program files (x86)\whatever\program.exe" (place UninstallString contents here)

In my experience, to use wmic in a script, you need to get the nested quoting right:

wmic product where "name = 'Windows Azure Authoring Tools - v2.3'" call uninstall /nointeractive 

quoting both the query and the name. But wmic will only uninstall things installed via windows installer.


Examples related to windows-7

ng is not recognized as an internal or external command Why am I getting ImportError: No module named pip ' right after installing pip? How to Delete node_modules - Deep Nested Folder in Windows Telnet is not recognized as internal or external command Multiple -and -or in PowerShell Where-Object statement How do I set ANDROID_SDK_HOME environment variable? Run Batch File On Start-up Why isn't .ico file defined when setting window's icon? How to access shared folder without giving username and password Can't start hostednetwork

Examples related to batch-file

'ls' is not recognized as an internal or external command, operable program or batch file '' is not recognized as an internal or external command, operable program or batch file XCOPY: Overwrite all without prompt in BATCH CanĀ“t run .bat file under windows 10 Execute a batch file on a remote PC using a batch file on local PC Windows batch - concatenate multiple text files into one How do I create a shortcut via command-line in Windows? Getting Error:JRE_HOME variable is not defined correctly when trying to run startup.bat of Apache-Tomcat Curl not recognized as an internal or external command, operable program or batch file Best way to script remote SSH commands in Batch (Windows)

Examples related to windows-xp

installing JDK8 on Windows XP - advapi32.dll error How to Create a script via batch file that will uninstall a program if it was installed on windows 7 64-bit or 32-bit How do I find files with a path length greater than 260 characters in Windows? Apache Maven install "'mvn' not recognized as an internal or external command" after setting OS environmental variables? How to access share folder in virtualbox. Host Win7, Guest Fedora 16? How to create ls in windows command prompt? How to fix an UnsatisfiedLinkError (Can't find dependent libraries) in a JNI project How to use random in BATCH script? How to delete or change directory of a cloned git repository on a local computer How do I manually create a file with a . (dot) prefix in Windows? For example, .htaccess

Examples related to uninstallation

How to uninstall Eclipse? How to remove docker completely from ubuntu 14.04 How to completely uninstall kubernetes How to uninstall Anaconda completely from macOS How to Completely Uninstall Xcode and Clear All Settings Remove composer How can I find the product GUID of an installed MSI setup? How to uninstall mini conda? python Force uninstall of Visual Studio How to remove a package from Laravel using composer?