Created
July 19, 2025 15:42
-
-
Save Inndy/375e2ba290bb14dd09b4115189ead840 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$registryPaths = @( | |
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", | |
"HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | |
) | |
function Get-SteamGames { | |
$steamGames = @() | |
foreach ($path in $registryPaths) { | |
if (Test-Path $path) { | |
$uninstallKeys = Get-ChildItem $path -ErrorAction SilentlyContinue | |
foreach ($key in $uninstallKeys) { | |
try { | |
$props = Get-ItemProperty $key.PSPath -ErrorAction SilentlyContinue | |
# Check if it's a Steam game - improved detection logic | |
$keyName = $key.Name.Split('\')[-1] # Get just the key name, not full path | |
$isSteamGame = $false | |
if ($props -and $keyName -like "Steam App *" -and $props.UninstallString -match 'steam\.exe.*steam://uninstall/') { | |
$isSteamGame = $true | |
} | |
if ($isSteamGame) { | |
$steamGames += [PSCustomObject]@{ | |
Name = $props.DisplayName | |
Publisher = $props.Publisher | |
Version = $props.DisplayVersion | |
InstallLocation = $props.InstallLocation | |
UninstallString = $props.UninstallString | |
RegistryKey = $key.Name | |
RegistryPath = $key.PSPath | |
KeyName = $keyName | |
} | |
} | |
} | |
catch { | |
# Skip entries that can't be read | |
continue | |
} | |
} | |
} | |
} | |
return $steamGames | Sort-Object Name | |
} | |
Get-SteamGames |% { Remove-Item $_.RegistryPath -Recurse -Force } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment