Untill now I have this, which is not working:
on error resume next
'option explicit
' Variable and constant Declarations
Const HKEY_LOCAL_MACHINE = &H80000002
Dim WshShell
Dim versionShort, FSO, objWMIService, colOperatingSystems
Dim sCommandline, ExitCode, strKeyPath1, RegRead
Dim quote, strComputer, objFSO, objCtx, objLocator, objServices, objReg, objReg1
'------------------------------------------------------------------------------
' Core variable definitions ---------------------------------------------------
'
strComputer = "."
Set WshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objCtx = CreateObject("WbemScripting.SWbemNamedValueSet")
objCtx.Add "__ProviderArchitecture", 64
Set objLocator = CreateObject("Wbemscripting.SWbemLocator")
Set objServices = objLocator.ConnectServer("","root\default","","",,,,objCtx)
Set objReg1 = objServices.Get("StdRegProv")
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'search 64 bit registry Uninstall-----------------------------------------------'
Dim strValue, strKeyPath, arrSubKeys, subkey, isInstalled
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys, subkey
For Each subkey In arrSubKeys
If (subkey = "{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}") Then 'Microsoft visual C++ 2010 x86 10,0,30319'
isInstalled = "1"
else
If (subkey = "{1D8E6291-B0D5-35EC-8441-6616F567A0F7}") Then 'Microsoft visual C++ 2010 x86 10,0,40219'
isInstalled = "1"
End If
End If
Next
'search 32 bit registry Uninstall------------------------------------------------'
Dim arrSubKeys1, subkey1
strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys1, subkey1
For Each subkey1 In arrSubKeys1
If (subkey1 = "{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}") Then 'Microsoft visual C++ 2010 x86 10,0,30319'
isInstalled = "1"
else
If (subkey1 = "{1D8E6291-B0D5-35EC-8441-6616F567A0F7}") Then 'Microsoft visual C++ 2010 x86 10,0,40219'
isInstalled = "1"
End If
End If
Next
if isInstalled = 0 Then
Dim WShell
Dim sInstallCommand
Dim sPath, oExecShell, errReturn
Set WShell = CreateObject("WScript.Shell")
sPath = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))
sInstallCommand = 'command line'
Function ExecuteCommandLine (CommandLine)
Set oExecShell = WShell.Exec (CommandLine)
Do While oExecShell.Status = 0: WScript.Sleep 50: Loop
errReturn = oExecShell.ExitCode
ExecuteCommandLine = errReturn
End Function
Wscript.Quit()
End if