79093397

Date: 2024-10-16 09:34:57
Score: 3.5
Natty:
Report link

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"
Reasons:
  • Blacklisted phrase (1): to comment
  • RegEx Blacklisted phrase (1.5): I don't have enough reputation to comment
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Yannic
  • Low reputation (1):
Posted by: chukcha