The installer WMI classes (
Win32_SoftwareElement) don't provide this information: there is no requirement that there is a single location at any of those levels. Therefore something application specific is needed.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\100
VerSpecificRootDir with the base folder. And it looks like replacing the
100 with the correct number (ie. SQL Server version times ten) will work across versions.