Files
cdrp/uninstall-autostart.ps1
2026-06-18 22:26:11 -07:00

27 lines
947 B
PowerShell

# Stops the CDRP helper and removes it from Windows startup.
# powershell -ExecutionPolicy Bypass -File uninstall-autostart.ps1
$ErrorActionPreference = 'SilentlyContinue'
$startup = [Environment]::GetFolderPath('Startup')
$lnkPath = Join-Path $startup 'CDRP Helper.lnk'
if (Test-Path $lnkPath) {
Remove-Item $lnkPath -Force
Write-Host "Removed auto-start shortcut." -ForegroundColor Green
} else {
Write-Host "No auto-start shortcut was installed."
}
# Stop the running helper (a node process running our index.js from the cdrp folder).
$stopped = $false
Get-CimInstance Win32_Process -Filter "Name = 'node.exe'" |
Where-Object { $_.CommandLine -match 'cdrp' -and $_.CommandLine -match 'index\.js' } |
ForEach-Object {
Stop-Process -Id $_.ProcessId -Force
Write-Host "Stopped helper (PID $($_.ProcessId))." -ForegroundColor Green
$script:stopped = $true
}
if (-not $stopped) { Write-Host "Helper wasn't running." }