MSI API: Here is a sample using VBScript to get the installation path for Microsoft Visual C++ 2012 x86 Minimum Runtime - 11.0.50727 - update GUIDs for your purpose (obviously):
Set i = CreateObject("WindowsInstaller.Installer")
' Microsoft Visual C++ 2012 x86 Minimum Runtime - 11.0.50727
MsgBox i.ComponentPath("{2F73A7B2-E50E-39A6-9ABC-EF89E4C62E36}","{F5CBD6DC-5C9C-430E-83A7-179BA49988CD}")
Installer.ComponentPath method:
- The first parameter is the product code.
- The second parameter is the component code.
GUIDs: Open the MSI in question with Orca (or equivalent, see link) to find the Product code in the "Property Table" and the Component code in the "Component Table".
For installed packages you can do as follows:
Find Cached MSI: The below PowerShell script is from here. It will allow you to find the local cache path for the installed MSI.
gwmi -Query "SELECT Name,LocalPackage FROM Win32_Product WHERE IdentifyingNumber='{2F73A7B2-E50E-39A6-9ABC-EF89E4C62E36}'" | Format-Table Name,LocalPackage
Links: