Last active
March 24, 2024 22:35
-
-
Save nopeless/2621be04771318fa9ebb8994c245d0e8 to your computer and use it in GitHub Desktop.
uninstall razer script because the uninstaller doesn't properly uninstall
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
Set-PSDebug -Strict | |
Set-StrictMode -Version Latest | |
$WarningPreference = "Inquire" | |
$ErrorActionPreference = "Stop" | |
$rp = Get-Process | ? { $_ -like "*razer*" } | |
if ($rp -and $rp.Count -gt 0) { | |
Write-Host "Potential Razer processes:" | |
foreach ($p in $rp) { | |
Write-Host $p | |
} | |
Write-Warning "Some razer processes seem to be running`nContinue if they aren't razer processes. Otherwise, stop these processes first then exit and restart this script" | |
} | |
foreach ($path in @( | |
"$env:ProgramData\Razer", | |
"$env:ProgramFiles\Razer", | |
"${env:ProgramFiles(x86)}\Razer", | |
"$env:LOCALAPPDATA\Razer", | |
"$env:LOCALAPPDATA\Razer Chroma SDK", | |
"$env:TMP\Razer", | |
"$env:TMP\Razer Chroma SDK", | |
"C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming\Razer Inc", | |
"C:\Windows\Installer\Razer", | |
"C:\Windows\Installer\RazerSynapse", | |
"$([Environment]::GetFolderPath('StartMenu'))\Programs\Razer", | |
"$([Environment]::GetFolderPath('CommonStartMenu'))\Programs\Razer" | |
)) { | |
Write-Host "Testing: $path" | |
if (Test-Path -LiteralPath $path) { | |
Remove-Item -Recurse -Force -LiteralPath $path | |
Write-Host "Removed" | |
} | |
} | |
$ss = Get-Service -ErrorAction SilentlyContinue | ? { $_ -Like "*razer*" } | |
foreach ($s in $ss) { | |
Write-Host "Testing service: $s" | |
Remove-Service $s -Confirm | |
} | |
foreach ($reg in @( | |
"HKLM:\SOFTWARE\RAZERWUD" | |
)) { | |
Write-Host "Testing: $reg" | |
if (Test-Path -LiteralPath $reg) { | |
Remove-Item -Force -Recurse -LiteralPath $reg | |
Write-Host "Removed" | |
} | |
} | |
foreach ($reg in (Get-ChildItem -LiteralPath "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Tracing" | ? { $_ -like "*razer*" } | % { $_.PSChildName })) { | |
$p = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Tracing\$reg" | |
Remove-Item -Recurse -Force -LiteralPath $p | |
Write-Host "Removed $p" | |
} | |
Write-Host "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment