1

Using windows, I can uninstall software via script/command line as follows:

msiexec /x {00000000-0000-0000-0000-000000000000}

Is there a method to just test for the existence of the given package, without affecting it?

I'm interested in a true/false or any other input, indicating whether the package exists on the machine, and can be removed using Windows installer with the given command.

2

You can use REGEDIT command and check, if the key with name corresponding to the product code of package is present under the following key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

If it is not there, it can also be here:

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

Following BATCH command can do it for you, only replace the product code with real one:

@echo off
SET PRODUCTKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
REM *** Write your package code here
REG QUERY %PRODUCTKEY%\{00000000-0000-0000-0000-000000000000}
IF NOT %ERRORLEVEL% EQU 0 (GOTO :INSTALL) ELSE GOTO :ENDHERE  
:INSTALL
ECHO Not installed
GOTO :END 
:ENDHERE
ECHO Installed
GOTO :END
:END

Or the one-line version:

REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{00000000-0000-0000-0000-000000000000}

Alternatively you can run

msiexec.exe /fp {00000000-0000-0000-0000-000000000000}

which repairs a package only if a file is missing, so it should do nothing to correctly installed packages. But the installer would be launched and would try to repair the installed package.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.