10 Commits

5 changed files with 122 additions and 10 deletions

View File

@@ -3,7 +3,7 @@
<assemblyIdentity <assemblyIdentity
type="win32" type="win32"
name="PrintCleaner.App" name="PrintCleaner.App"
version="1.0.23.0" version="1.0.27.0"
processorArchitecture="amd64" processorArchitecture="amd64"
/> />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">

View File

@@ -241,6 +241,13 @@ function Invoke-UninstallSoftware {
# Common printer brands/keywords # Common printer brands/keywords
$brands = @("HP", "Hewlett-Packard", "Canon", "Epson", "Brother", "Xerox", "Kyocera", "Ricoh", "Lexmark", "Konica", "Samsung", "Oki", "Zebra", "Dymo", "Dell") $brands = @("HP", "Hewlett-Packard", "Canon", "Epson", "Brother", "Xerox", "Kyocera", "Ricoh", "Lexmark", "Konica", "Samsung", "Oki", "Zebra", "Dymo", "Dell")
# Internal Registry of Known Printer App GUIDs (for apps not detected by name)
# Format: "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}"
$knownGuids = @(
"{DB5EDF09-A7A7-47FA-B365-A7500A472878}", # EpsonNet Print
"{3361D415-BA35-4143-B301-661991BA6219}" # MyEpson Portal
)
$allSoftware = Get-InstalledSoftware $allSoftware = Get-InstalledSoftware
# Use ArrayList to avoid type issues # Use ArrayList to avoid type issues
@@ -249,13 +256,27 @@ function Invoke-UninstallSoftware {
# Filter software list # Filter software list
foreach ($sw in $allSoftware) { foreach ($sw in $allSoftware) {
$isMatch = $false
# Check 1: Brand Keywords
foreach ($brand in $brands) { foreach ($brand in $brands) {
if ($sw.DisplayName -match "(?i)\b$brand\b") { # Case insensitive regex match if ($sw.DisplayName -match "(?i)\b$brand\b") {
# This -match operator was overwriting the old $matches variable! $isMatch = $true
[void]$foundSoftware.Add($sw)
break break
} }
} }
# Check 2: Known GUIDs
if (-not $isMatch) {
if ($knownGuids -contains $sw.RegistryKeyName) {
$isMatch = $true
Write-Host " [+] Found by GUID: $($sw.DisplayName)" -ForegroundColor Cyan
}
}
if ($isMatch) {
[void]$foundSoftware.Add($sw)
}
} }
if ($foundSoftware.Count -eq 0) { if ($foundSoftware.Count -eq 0) {
@@ -352,10 +373,20 @@ function Invoke-UninstallSoftware {
Write-Host " [!] Error launching: $($_.Exception.Message)" -ForegroundColor Red Write-Host " [!] Error launching: $($_.Exception.Message)" -ForegroundColor Red
} }
Write-Host " (Press ENTER to continue to next app...)" -ForegroundColor DarkGray Write-Host " (Press ENTER to continue, or 'F' to Force Delete Registry Key...)" -ForegroundColor Yellow
[void](Read-Host) $uInput = Read-Host
if ($uInput -match "^[Ff]$") {
Write-Host " [-] Removing Registry Key: $($app.RegPath)" -ForegroundColor Red
try {
Remove-Item -Path $app.RegPath -Recurse -Force -ErrorAction Stop
Write-Host " Registry entry removed." -ForegroundColor Green
} catch {
Write-Host " [!] Failed to remove registry key: $($_.Exception.Message)" -ForegroundColor Red
} }
Write-Progress -Activity "Uninstalling Software" -Completed Write-Host "`nDone processing list." -ForegroundColor Green }
}
Write-Progress -Activity "Uninstalling Software" -Completed
Write-Host "`nDone processing list." -ForegroundColor Green
Wait-Key Wait-Key
return return
} }
@@ -414,11 +445,23 @@ function Invoke-UninstallSoftware {
} catch { } catch {
Write-Host "Error launching uninstaller: $($_.Exception.Message)" -ForegroundColor Red Write-Host "Error launching uninstaller: $($_.Exception.Message)" -ForegroundColor Red
} }
Write-Host "Done." -ForegroundColor Green
Write-Host "`nPress 'F' to Force Delete Registry Key, or any key to continue..." -ForegroundColor Yellow
$k = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
if ($k.Character -match "[Ff]") {
Write-Host " [-] Removing Registry Key: $($app.RegPath)" -ForegroundColor Red
try {
Remove-Item -Path $app.RegPath -Recurse -Force -ErrorAction Stop
Write-Host " Registry entry removed." -ForegroundColor Green
Start-Sleep -Seconds 1
} catch {
Write-Host " [!] Failed to remove registry key: $($_.Exception.Message)" -ForegroundColor Red
Start-Sleep -Seconds 2 Start-Sleep -Seconds 2
} }
} }
} }
}
}
# --- Main Loop --- # --- Main Loop ---

View File

@@ -1 +1 @@
1.0.23 1.0.27

56
utils/GetGUIDApp.ps1 Normal file
View File

@@ -0,0 +1,56 @@
<#
.SYNOPSIS
Lists installed software and their GUIDs/Registry Keys.
.DESCRIPTION
This script scans the Windows Registry (HKLM and WOW6432Node) for installed applications
and outputs their Display Name and Registry Key Name (which is often the MSI GUID).
Useful for finding the GUID of software to target for uninstallation.
.PARAMETER Filter
Optional string to filter the results by Display Name.
.EXAMPLE
.\GetGUIDApp.ps1
Lists all installed software in a grid view.
.EXAMPLE
.\GetGUIDApp.ps1 -Filter "Printer"
Lists only software with "Printer" in the name.
#>
param (
[string]$Filter = ""
)
$paths = @(
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*",
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
)
Write-Host "Scanning Registry for Installed Software..." -ForegroundColor Cyan
$results = @()
foreach ($path in $paths) {
$items = Get-ItemProperty $path -ErrorAction SilentlyContinue
foreach ($item in $items) {
if (-not [string]::IsNullOrWhiteSpace($item.DisplayName)) {
$results += [PSCustomObject]@{
DisplayName = $item.DisplayName
RegistryKeyName = $item.PSChildName # This is the GUID for MSI apps
UninstallString = $item.UninstallString
}
}
}
}
if (-not [string]::IsNullOrWhiteSpace($Filter)) {
Write-Host "Filtering for: '$Filter'" -ForegroundColor Yellow
$results = $results | Where-Object { $_.DisplayName -match "(?i)$Filter" }
}
$results | Sort-Object DisplayName | Out-GridView -Title "Installed Software (Select to see details)"
Write-Host "Done. Check the Grid View window." -ForegroundColor Green

13
utils/get_guids.txt Normal file
View File

@@ -0,0 +1,13 @@
# PowerShell command to list installed software and their Registry Key Names (often GUIDs).
# Run this command in a PowerShell window on your Windows machine.
#
# To filter the results, you can use the 'Filter' parameter, e.g., Filter "HP"
#
# Example:
# To get all software:
# Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Select-Object DisplayName, PSChildName | Sort-Object DisplayName | Out-GridView
#
# To filter by a keyword (e.g., "Printer"):
# Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -match "Printer" } | Select-Object DisplayName, PSChildName | Sort-Object DisplayName | Out-GridView
#
Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Select-Object DisplayName, PSChildName | Sort-Object DisplayName | Out-GridView