diff --git a/deploy/worker-windows/RippyWorkerSetup.exe b/deploy/worker-windows/RippyWorkerSetup.exe index 8014d3a..3d1d74c 100644 Binary files a/deploy/worker-windows/RippyWorkerSetup.exe and b/deploy/worker-windows/RippyWorkerSetup.exe differ diff --git a/deploy/worker-windows/install-gui.ps1 b/deploy/worker-windows/install-gui.ps1 index 808c07a..c8ab523 100644 --- a/deploy/worker-windows/install-gui.ps1 +++ b/deploy/worker-windows/install-gui.ps1 @@ -525,6 +525,45 @@ if (-not `$Force) { `$ordner = `$PSScriptRoot +# ⚠️ ADMINRECHTE. Der Standard-Zielordner liegt unter "C:\Program Files", und +# der gehört nicht dem Benutzer — jedes Remove-Item darin scheitert mit "Der +# Zugriff auf den Pfad wurde verweigert" (Commander-Befund 26.07.2026, an +# HandBrakes doc\LICENSE und Konsorten aufgelaufen). Die Installer-.exe ist mit +# -requireAdmin gebaut und fragt beim Start per UAC; der Deinstaller hatte +# nichts Vergleichbares und war damit im Standardfall nutzlos. +# +# GEMESSEN statt angenommen: Es wird ein Schreibversuch gemacht. Wer den Worker +# ins eigene Profil installiert hat, braucht keine Erhöhung und bekommt auch +# keine UAC-Frage. +`$schreibbar = `$false +try { + `$probe = Join-Path `$ordner ".deinstall-probe" + Set-Content -Path `$probe -Value "x" -ErrorAction Stop + Remove-Item -Force `$probe -ErrorAction SilentlyContinue + `$schreibbar = `$true +} catch { } + +`$istAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() + ).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) + +if (-not `$schreibbar -and -not `$istAdmin) { + # Sich selbst erhöht neu starten. -Force, weil oben schon zugestimmt wurde — + # sonst käme die Frage zweimal. + try { + Start-Process powershell.exe -Verb RunAs -ArgumentList @( + "-NoProfile", "-ExecutionPolicy", "Bypass", + "-File", ('"' + `$PSCommandPath + '"'), "-Force") + } catch { + [System.Windows.Forms.MessageBox]::Show( + "Zum Entfernen sind Administratorrechte nötig (der Ordner liegt " + + "unter 'Programme'), und die Anfrage wurde abgelehnt.`n`n" + + "Alternative: PowerShell mit Rechtsklick 'Als Administrator " + + "ausführen' starten und dieses Skript erneut aufrufen.", + "Rippy Worker", 0, [System.Windows.Forms.MessageBoxIcon]::Warning) | Out-Null + } + exit +} + # 1. Alles beenden, was aus diesem Ordner läuft (Tray, celery, HandBrake). Get-CimInstance Win32_Process | Where-Object { `$_.ExecutablePath -like "`$ordner*" diff --git a/deploy/worker-windows/install.ps1 b/deploy/worker-windows/install.ps1 index 570ebf9..c5ffa31 100644 --- a/deploy/worker-windows/install.ps1 +++ b/deploy/worker-windows/install.ps1 @@ -215,6 +215,33 @@ if (-not `$Force) { `$antwort = Read-Host "Rippy-Worker '$WorkerName' wirklich deinstallieren? (j/n)" if (`$antwort -ne "j") { Write-Host "Abgebrochen."; exit } } + +# ⚠️ ADMINRECHTE. Der Standard-Zielordner liegt unter "C:\Program Files", und der +# gehört nicht dem Benutzer — jedes Remove-Item darin scheitert mit "Der Zugriff +# auf den Pfad wurde verweigert" (Commander-Befund 26.07.2026). Geprüft wird per +# Schreibversuch, nicht per Annahme: Wer ins eigene Profil installiert hat, +# bekommt keine UAC-Frage. +`$schreibbar = `$false +try { + `$probe = Join-Path `$PSScriptRoot ".deinstall-probe" + Set-Content -Path `$probe -Value "x" -ErrorAction Stop + Remove-Item -Force `$probe -ErrorAction SilentlyContinue + `$schreibbar = `$true +} catch { } +`$istAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() + ).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) +if (-not `$schreibbar -and -not `$istAdmin) { + Write-Host "Der Ordner liegt unter 'Programme' — starte mich mit Administratorrechten neu ..." -ForegroundColor Yellow + try { + Start-Process powershell.exe -Verb RunAs -ArgumentList @( + "-NoProfile", "-ExecutionPolicy", "Bypass", + "-File", ('"' + `$PSCommandPath + '"'), "-Force") + } catch { + Write-Host "FEHLER: Erhöhung abgelehnt. PowerShell mit Rechtsklick 'Als Administrator ausführen' starten und erneut aufrufen." -ForegroundColor Red + } + exit +} + Get-CimInstance Win32_Process | Where-Object { `$_.ExecutablePath -like "`$PSScriptRoot*" } | ForEach-Object { Stop-Process -Id `$_.ProcessId -Force -ErrorAction SilentlyContinue }