Compare commits
10 Commits
5f822cc9b5
...
64353d3394
| Author | SHA1 | Date | |
|---|---|---|---|
| 64353d3394 | |||
| b6957b8118 | |||
| d31342390e | |||
| 9a2b794df6 | |||
| 9d47755cfa | |||
| 1eb64bb120 | |||
| 9652a98e3e | |||
| adeef97796 | |||
| 4486465b67 | |||
| fd285f2cf4 |
@@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="PrintCleaner.App"
|
||||
version="1.0.23.0"
|
||||
version="1.0.27.0"
|
||||
processorArchitecture="amd64"
|
||||
/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
|
||||
@@ -241,6 +241,13 @@ function Invoke-UninstallSoftware {
|
||||
# Common printer brands/keywords
|
||||
$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
|
||||
|
||||
# Use ArrayList to avoid type issues
|
||||
@@ -249,13 +256,27 @@ function Invoke-UninstallSoftware {
|
||||
|
||||
# Filter software list
|
||||
foreach ($sw in $allSoftware) {
|
||||
$isMatch = $false
|
||||
|
||||
# Check 1: Brand Keywords
|
||||
foreach ($brand in $brands) {
|
||||
if ($sw.DisplayName -match "(?i)\b$brand\b") { # Case insensitive regex match
|
||||
# This -match operator was overwriting the old $matches variable!
|
||||
[void]$foundSoftware.Add($sw)
|
||||
if ($sw.DisplayName -match "(?i)\b$brand\b") {
|
||||
$isMatch = $true
|
||||
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) {
|
||||
@@ -352,10 +373,20 @@ function Invoke-UninstallSoftware {
|
||||
Write-Host " [!] Error launching: $($_.Exception.Message)" -ForegroundColor Red
|
||||
}
|
||||
|
||||
Write-Host " (Press ENTER to continue to next app...)" -ForegroundColor DarkGray
|
||||
[void](Read-Host)
|
||||
Write-Host " (Press ENTER to continue, or 'F' to Force Delete Registry Key...)" -ForegroundColor Yellow
|
||||
$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
|
||||
return
|
||||
}
|
||||
@@ -414,8 +445,20 @@ function Invoke-UninstallSoftware {
|
||||
} catch {
|
||||
Write-Host "Error launching uninstaller: $($_.Exception.Message)" -ForegroundColor Red
|
||||
}
|
||||
Write-Host "Done." -ForegroundColor Green
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
56
utils/GetGUIDApp.ps1
Normal file
56
utils/GetGUIDApp.ps1
Normal 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
13
utils/get_guids.txt
Normal 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
|
||||
Reference in New Issue
Block a user