Jump to content
Sign in to follow this  
CaptainGadget

How to Test if Microsoft C+++ Redistributable Runtimes are Installed

Recommended Posts

CaptainGadget

Is there an easy method or UDF to test if the Microsoft C+++ 2005 or 2008 Redistributable Runtimes are installed?

I could use this code for several automated installers I'm working on that would allow me to install the latest version of the redistributables in advance of the software installing its own, possible outdated, version of the redistributable on its own.

Thanks, in advance, for any assistance you may be able to provide.

Captain Gadget

Share this post


Link to post
Share on other sites
bo8ster

The installer is not smart, no way to check that I know but the good thing is it doesn't matter if you install over the top. Type /? to get the options.

Currently I have the latest postgres installing 2005 then install 2008 over the top. Looking in the control panel, it shows both are installed.

I use

vcredist_x86_08.exe /q:a /c:"msiexec /i vcredist.msi /qb!"
. If you want that in AutoIt, put it in a Run command but remember its a dos command. Edited by bo8ster

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites
CaptainGadget

The installer is not smart, no way to check that I know but the good thing is it doesn't matter if you install over the top. Type /? to get the options.

Currently I have the latest postgres installing 2005 then install 2008 over the top. Looking in the control panel, it shows both are installed.

I use

vcredist_x86_08.exe /q:a /c:"msiexec /i vcredist.msi /qb!"
. If you want that in AutoIt, put it in a Run command but remember its a dos command.

Thanks for the response. While I realize that re-installing or over-installing the runtimes is certainly an option, I was sort of hoping a cleaner method existed, such as a registry location check or a UDF that would identify the version(s) installed. However, if I can't find anything I will go with your suggestion to install the latest version(s) no matter what.

Captain Gadget

Share this post


Link to post
Share on other sites
bo8ster

I did some searching in the reg - searched for "Redistributable" and found the following keys. You can use RegRead to read the keys. You can also use RegSearch, I have seen it all over the forum and managed to a version from PSaltyDS RegSearch()

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\6F9E66FF7E38E3A3FA41D89E8A906A4A\InstallProperties]
"DisplayName"="Microsoft Visual C++ 2008 Redistributable - x86 9.0.21022"

HKEY_CLASSES_ROOT\Installer\Products\6F9E66FF7E38E3A3FA41D89E8A906A4A]
"ProductName"="Microsoft Visual C++ 2008 Redistributable - x86 9.0.21022"

S-1-5-18 is a user id, that may help.

6F9E66FF7E38E3A3FA41D89E8A906A4A Looks like a random GUID - no real help there.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites
rajeshontheweb
rajeshontheweb
bo8ster

i thought GUID's cant be random, and its not.

They can be, depends on what they are used for. I have no clue what "6F9E66FF7E38E3A3FA41D89E8A906A4A" is used for or if it is the same on someone else's computer. They keys are from a embedded os, not normal windows, I don't want to assume.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites
CaptainGadget

Thank, guys, for all the ideas. I think I've hit upon a method I'll use for testing. Below is a sample script using rajeshontheweb's suggested methodology.

You should be aware that there is one caveat when this method will not detect if the proper runtime has been installed. There are method's of installing the runtimes without the use of an msi installer. One example of what I'm referring to can be found here: Kels' Runtimes

However, in this case, I'll probably just go ahead and reinstall the runtimes again, anyway, unless I can come up with a better testing method.

Thanks, again, for all the great ideas!

Captain Gadget

Global $GUID[4] = ["{1F1C2DFC-2D24-3E06-BCB8-725134ADF989}", "{9A25302D-30C0-39D9-BD6F-21E6EC160475}", "{5DA8F6CD-C70E-39D8-8430-3D9808D6BD17}", "{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}"] ; Name of GUID's in order of newest to oldest
Global $RTFlag = 0

; Here we will test to see if any version of the Microsoft C++ 2008 Runtimes have been installed on this system
For $TestGUID In $GUID
    $ReturnCode = DLLCall("msi.dll","int","MsiQueryProductState","str",$TestGUID)
    If $ReturnCode[0] = 5 Then  ; Runtime is installed on system: we can continue
        $RTFlag = 1 ; Set flag indicating proper runtime is installed
        ExitLoop ; We're done testing
    EndIf
Next

If $RTFlag <> 1 Then ; we need to install latest Runtime
    MsgBox(0, "Status", "Runtime Installation is required") ; Replace this with your installation routine
EndIf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×