You might look at some very old code I have here.

My Computer Info script

Software depends on what type of installer was used. Some locations are updated/added for MSI that regular EXE Installers don't use the same location. Certainly a haberdashery of methods in the Registry. Then some applications use a display name or product name and some don't which makes it very difficult to be 100%