How do I get a list of software products which are installed on the system. My goal is to iterate through these, and get the installation path of a few of them.
PSEUDOCODE ( combining multiple languages 🙂 )
foreach InstalledSoftwareProduct
if InstalledSoftwareProduct.DisplayName LIKE *Visual Studio*
print InstalledSoftwareProduct.Path
You can use MSI api functions to enumerate all installed products. Below you will find sample code which does that.
In my code I first enumerate all products, get the product name and if it contains the string “Visual Studio” I check for the
InstallLocationproperty. However, this property is not always set. I don’t know for certain whether this is not the right property to check for or whether there is another property that always contains the target directory. Maybe the information retrieved from theInstallLocationproperty is sufficient for you?