Can someone help me out with finding specific GUID's and if it's found, go to the next process, and if not, install a msi. I'm trying to install an application with pre-requisites, and don't have the conditions right now.

1 Comment   [ + ] Show Comment

Comments

  • Hi guy , do you want a install or launch condition for the MSI ? Instead to do it by script, you can use the MSI features ... make a Install Condition with the System Search and looking for the Registry entry.
Please log in to comment

Community Chosen Answer

3

here you go:

 

Const HKEY_LOCAL_MACHINE =&H80000002Dim RegKey 'Dim objWshShell'Set objWshShell = CreateObject("WScript.shell")' strComputer ="."'Set objRegistry = GetObject("winmgmts:\\"& strComputer &"\root\default:StdRegProv")' RegKey="test" strKeyPath ="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"' objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath&"\"&RegKey,"",strValue ''check if the value existsIf IsNull(strValue)Then'the key doesnt exist wsh.echo "Not found"
'run your install code here else wsh.echo "Found:", strValue EndIf

 

 

Answered 08/15/2013 by: mattski
Second Degree Green Belt

Please log in to comment

Answers

2

Here is a script i use for checking if the product is installed or not. It works on both 32bit and 64bit machines.

'****************************
'Declaration
'****************************

Dim Installer
Dim productcode

'****************************
'Initialisation
'****************************

ArgProductcode = "{XXX-XXX-XXX}"    'Enter the required Product code
set Installer = CreateObject("WindowsInstaller.Installer")

Set ProductCodes = CreateObject ("System.Collections.ArrayList")

'****************************
'Execution
'***************************

ProductCodes.Add ArgProductcode

For each productcode in Productcodes
 if Installer.ProductState(productcode) = 5 then 
  Msgbox "found"
 Else
    Msgbox "not found"
 End If
Next

'****************************
'Termination
'***************************
Set ProductCodes = Nothing
set Installer = Nothing

 

Answered 08/22/2013 by: Sujit J
Blue Belt

Please log in to comment
0

Here is another method you can use. Either from a script or a custom action within MSI.

http://www.itninja.com/blog/view/searching-for-installed-msi-s-via-wisescript

Answered 08/19/2013 by: ekgcorp
Tenth Degree Black Belt

Please log in to comment
Answer this question or Comment on this question for clarity