The value after Uninstall
can be anything. The only requirement from Windows is that it is unique. Some apps use their names while other apps use a GUID that they have generated. It is not something you can code against.
I'm not sure what you're trying to do exactly but if you want to find the VS installations then the preference is to use VSWhere
. But if you must scan the registry then you'll need to look in all the subkeys. You'll need to do a fuzzy match on DisplayName
to find the Visual Studio*
entry(ies) and then you can rename from there. AFAIK there is no way to find the uninstall key otherwise as this is just standard Windows stuff.
Alternatively you could probably use WMI to get the installed apps and get the registry key from there but you'll still end up doing a match against the product name, not the underlying registry key.