I don't have enough reputation to comment. But if you use solution from @Yannic Hamann, you need to 'break' inside 'if'.
$productName = "Your unique app name" # this should basically match against your previous
# installation path. Make sure that you don't mess with other components used
# by any other MSI package
$components = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\
$count = 0
foreach ($c in $components)
{
foreach($p in $c.Property)
{
$propValue = (Get-ItemProperty "Registry::$($c.Name)" -Name "$($p)")."$($p)"
if ($propValue -match $productName)
{
Write-Output $c.Name
$path = $c.Name.Replace('HKEY_LOCAL_MACHINE','HKLM:')
#uncomment line below to cleanup registry
#Remove-Item $path -Recurse
$count++
break
}
}
}
Write-Host "$($count) key(s) found"