/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 11 years ago

Answers (3)

Posted by: mattski 11 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 11 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 11 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

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
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