$ErrorActionPreference = 'Continue'
foreach ($k in @(
    'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
    'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall',
    'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion',
    'HKLM:\SOFTWARE\WOW6432Node\RepairTech'
)) {
    $exists = Test-Path $k
    $line = "KEY $k exists=$exists"
    if ($exists) {
        try { $acl = Get-Acl $k; $line += ' owner=' + $acl.Owner }
        catch { $line += ' acl-read-FAILED: ' + $_.Exception.Message }
    }
    Write-Output $line
}
Write-Output '=== subkey counts ==='
try { Write-Output ('64-bit Uninstall subkeys: ' + (Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' -EA Stop).Count) } catch { Write-Output ('64-bit enum FAILED: ' + $_.Exception.Message) }
try { Write-Output ('32-bit Uninstall subkeys: ' + (Get-ChildItem 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall' -EA Stop).Count) } catch { Write-Output ('32-bit enum FAILED: ' + $_.Exception.Message) }
Write-Output '=== write test (32-bit view, as the installer would) ==='
try {
    $t = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\_acg_writetest'
    New-Item $t -Force -EA Stop | Out-Null
    Remove-Item $t -Force -EA Stop
    Write-Output 'WRITE-TEST-OK'
} catch { Write-Output ('WRITE-TEST-FAILED: ' + $_.Exception.Message) }
Write-Output '=== C:\Program Files\RepairTech leftovers ==='
if (Test-Path 'C:\Program Files\RepairTech') {
    Get-ChildItem 'C:\Program Files\RepairTech' -Recurse -EA SilentlyContinue | Select-Object -First 25 | ForEach-Object { Write-Output $_.FullName }
} else { Write-Output 'NOT-PRESENT' }
