We help IT Professionals succeed at work.
Get Started

VBScript Registry Check

aquias2000 asked
Last Modified: 2012-09-06
The script is set to look for folders and create them.  Then to check for a registry key path and if it doesn't exist to run an install.  It runs properly the first time through, but subsequent runs of the scripts do not run the MSI, confirmed that the key is gone, and trying to run the script without the registry check launches the MSI.

Any help is appreciated.

Dim objFSO, WshShell

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
Set wshShell = CreateObject("WScript.Shell")
Set objRegistry = GetObject("winmgmts:\\" & _
     strComputer & "\root\default:StdRegProv")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists("C:\Windows\TEMP\") Then
End If

If Not objFSO.FolderExists("C:\Windows\TEMP\Logs") Then
End If
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Uninstall"
strValueName = "{3FE28AA5-8140-47E4-A0D3-974F24831556}"
objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName
      If IsNull(strValueName) Then
      Wshshell.run "msiexec.exe /i <path to MSI> /qn /l*v C:\Windows\temp\Logs\GFI2012GPOInstall.log"
End If
Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE