38 lines
1.9 KiB
PowerShell
38 lines
1.9 KiB
PowerShell
# Removes The Kurgan's startup task and stops it (an LLM server it started stops with it).
|
|
# -RestoreAIServices re-enables and starts the "Strata Local Service" and "Qwen4 Local Service" tasks
|
|
# -RemovePawnIO also uninstalls PawnIO (leave it if LibreHardwareMonitor or FanControl uses it)
|
|
# Settings stay in %LOCALAPPDATA%\Kurgan.
|
|
param([switch]$RemovePawnIO, [switch]$RestoreAIServices)
|
|
|
|
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(
|
|
[Security.Principal.WindowsBuiltInRole]::Administrator)
|
|
if (-not $isAdmin) {
|
|
$extra = ''
|
|
if ($RemovePawnIO) { $extra += ' -RemovePawnIO' }
|
|
if ($RestoreAIServices) { $extra += ' -RestoreAIServices' }
|
|
Start-Process powershell -Verb RunAs -Wait -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"$extra"
|
|
exit
|
|
}
|
|
|
|
foreach ($name in 'The Kurgan', 'TT LCD Dashboard') {
|
|
Stop-ScheduledTask -TaskName $name -ErrorAction SilentlyContinue
|
|
Unregister-ScheduledTask -TaskName $name -Confirm:$false -ErrorAction SilentlyContinue
|
|
}
|
|
Get-CimInstance Win32_Process -Filter "Name like 'python%.exe'" |
|
|
Where-Object { $_.CommandLine -like '*lcd_dashboard.py*' -or $_.CommandLine -like '*-m kurgan*' } |
|
|
ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }
|
|
Write-Host "Removed 'The Kurgan'." -ForegroundColor Green
|
|
|
|
if ($RestoreAIServices) {
|
|
Start-Sleep -Seconds 2 # let the LLM server's port close
|
|
foreach ($name in 'Strata Local Service', 'Qwen4 Local Service') {
|
|
if (Get-ScheduledTask -TaskName $name -ErrorAction SilentlyContinue) {
|
|
Enable-ScheduledTask -TaskName $name | Out-Null
|
|
Start-ScheduledTask -TaskName $name
|
|
Write-Host "Re-enabled '$name'." -ForegroundColor Green
|
|
}
|
|
}
|
|
}
|
|
if ($RemovePawnIO) { winget uninstall --id namazso.PawnIO --exact --silent }
|
|
Start-Sleep -Seconds 3
|