Write-Output "=== HKCU Excel Addins ==="
$path = "HKCU:\Software\Microsoft\Office\Excel\Addins"
if (Test-Path $path) {
    Get-ChildItem $path | ForEach-Object {
        Write-Output "`n  Key: $($_.PSChildName)"
        Get-ItemProperty $_.PSPath | Format-List
    }
} else {
    Write-Output "  Path not found"
}

Write-Output "`n=== HKCU Word Addins ==="
$path = "HKCU:\Software\Microsoft\Office\Word\Addins"
if (Test-Path $path) {
    Get-ChildItem $path | ForEach-Object {
        Write-Output "`n  Key: $($_.PSChildName)"
        Get-ItemProperty $_.PSPath | Format-List
    }
} else {
    Write-Output "  Path not found"
}

Write-Output "`n=== HKCU PowerPoint Addins ==="
$path = "HKCU:\Software\Microsoft\Office\PowerPoint\Addins"
if (Test-Path $path) {
    Get-ChildItem $path | ForEach-Object {
        Write-Output "`n  Key: $($_.PSChildName)"
        Get-ItemProperty $_.PSPath | Format-List
    }
} else {
    Write-Output "  Path not found"
}

Write-Output "`n=== HKLM Excel Addins ==="
$path = "HKLM:\Software\Microsoft\Office\Excel\Addins"
if (Test-Path $path) {
    Get-ChildItem $path | ForEach-Object {
        Write-Output "`n  Key: $($_.PSChildName)"
        Get-ItemProperty $_.PSPath | Format-List
    }
} else {
    Write-Output "  Path not found"
}

Write-Output "`n=== HKLM WOW6432 Excel Addins ==="
$path = "HKLM:\Software\WOW6432Node\Microsoft\Office\Excel\Addins"
if (Test-Path $path) {
    Get-ChildItem $path | ForEach-Object {
        Write-Output "`n  Key: $($_.PSChildName)"
        Get-ItemProperty $_.PSPath | Format-List
    }
} else {
    Write-Output "  Path not found"
}

Write-Output "`n=== Search for any Datto/SmartBadge registry entries ==="
$results = reg query "HKCU\Software\Microsoft\Office" /s /f "Datto" 2>&1
$results | ForEach-Object { Write-Output $_ }
$results2 = reg query "HKLM\Software\Microsoft\Office" /s /f "Datto" 2>&1
$results2 | ForEach-Object { Write-Output $_ }
$results3 = reg query "HKLM\Software\WOW6432Node\Microsoft\Office" /s /f "SmartBadge" 2>&1
$results3 | ForEach-Object { Write-Output $_ }

Write-Output "`n=== SmartBadge DLL registration (CLSID) ==="
$results4 = reg query "HKLM\Software\Classes\CLSID" /s /f "SmartBadge" 2>&1
$results4 | Select-Object -First 20 | ForEach-Object { Write-Output $_ }
$results5 = reg query "HKCU\Software\Classes\CLSID" /s /f "SmartBadge" 2>&1
$results5 | Select-Object -First 20 | ForEach-Object { Write-Output $_ }
