/build/static/layout/Breadcrumb_cap_w.png

Script that searches up GUID in registry key & installs if not found

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
  • 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. - egiberne 10 years ago

Answers (3)

Posted by: mattski 10 years ago
Second Degree Green Belt
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

 

 

Posted by: Sujit J 10 years ago
Blue Belt
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

 

Posted by: ekgcorp 10 years ago
10th Degree Black Belt
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

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ