# ─── Script di configurazione automatica RustDesk per PoggioLab ───────────── # Esegui come Amministratore in PowerShell: # irm https://rustdesk.poggiolab.net/setup.ps1 | iex # oppure scarica ed esegui: .\setup.ps1 $ErrorActionPreference = "Stop" $RustDeskConfigDir = "$env:APPDATA\RustDesk\config" $RustDeskConfigFile = "$RustDeskConfigDir\config.toml" $DownloadUrl = "https://github.com/rustdesk/rustdesk/releases/latest/download/rustdesk-x86_64.exe" $TempInstaller = "$env:TEMP\rustdesk-installer.exe" Write-Host "=== Configurazione RustDesk per PoggioLab ===" -ForegroundColor Cyan # 1. Scarica RustDesk Write-Host "`n[1/4] Scaricamento RustDesk..." -ForegroundColor Yellow Invoke-WebRequest -Uri $DownloadUrl -OutFile $TempInstaller -UseBasicParsing Write-Host " -> Scaricato: $TempInstaller" -ForegroundColor Green # 2. Installa RustDesk Write-Host "`n[2/4] Installazione RustDesk..." -ForegroundColor Yellow Start-Process -FilePath $TempInstaller -ArgumentList "/S" -Wait Start-Sleep -Seconds 3 # 3. Crea directory di configurazione Write-Host "`n[3/4] Creazione configurazione..." -ForegroundColor Yellow New-Item -ItemType Directory -Force -Path $RustDeskConfigDir | Out-Null $configContent = @" # Configurazione RustDesk per PoggioLab # Generato automaticamente il $(Get-Date -Format "yyyy-MM-dd HH:mm") id-server = "rustdesk.poggiolab.net" relay-server = "rustdesk.poggiolab.net" key = "cyjuq5sRFHTxCH8ZIHbmjFIDiV5am44IuTBe3dITDig=" id-server-port = "21116" relay-server-port = "21117" use-websocket = true websocket-server = "wss://rustdesk.poggiolab.net:8443" direct-server = false approve-mode = "click" "@ Set-Content -Path $RustDeskConfigFile -Value $configContent -Encoding UTF8 Write-Host " -> Configurazione salvata: $RustDeskConfigFile" -ForegroundColor Green # 4. Riavvia RustDesk per applicare la configurazione Write-Host "`n[4/4] Riavvio RustDesk..." -ForegroundColor Yellow Get-Process "rustdesk" -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue Start-Sleep -Seconds 2 $RustDeskExe = "${env:ProgramFiles(x86)}\RustDesk\rustdesk.exe" if (-not (Test-Path $RustDeskExe)) { $RustDeskExe = "${env:ProgramFiles}\RustDesk\rustdesk.exe" } if (Test-Path $RustDeskExe) { Start-Process -FilePath $RustDeskExe Write-Host " -> RustDesk avviato!" -ForegroundColor Green } else { Write-Host " -> Avvia manualmente RustDesk dal menu Start" -ForegroundColor Yellow } Write-Host "`n=== Configurazione completata! ===" -ForegroundColor Cyan Write-Host "Server ID: rustdesk.poggiolab.net" -ForegroundColor White Write-Host "Relay: rustdesk.poggiolab.net" -ForegroundColor White Write-Host "WebSocket: wss://rustdesk.poggiolab.net:8443" -ForegroundColor White Write-Host "Chiave: cyjuq5sRFHTxCH8ZIHbmjFIDiV5am44IuTBe3dITDig=" -ForegroundColor White Write-Host "`nIl tuo RustDesk e' pronto per connettersi ai PC di PoggioLab!" -ForegroundColor Green