I'm reading a Registry Key in my NSIS Script to detect wether Microsoft Visual 2010 Redistributable is installed or not.
...
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}" "DisplayName"
${If} $R0 != ""
Messagebox MB_OK "C++ 2010 Redistributable detected"
goto yesCpp2010
${Else}
MessageBox MB_OK "C++ 2010 not found"
goto noCpp2010
${EndIf}
...
I tried it on Windows 7 and it works. But it won't work on other Windows Versions if the Programms have other Keys. Do they have the same Keys? If the Keys are different, is there a way to get them?
The GUID can probably change with Service Pack's and security updates but this blog claims you can just check the Installed
DWORD under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x64
.
For previous MSVC versions I would also suggest querying SxS but I don't think 2010 uses that technology...