param( [string]$DirektIP # Optional parameter to directly set the IP address ) # Define paths $iniPath = "C:\EDP\ELP\ELP.ini" $exePath = "C:\EDP\ELP\ELP.exe" # Function to update the Host= entry in the INI file function SetHostIP($ip) { if (Test-Path $iniPath) { $iniContent = Get-Content $iniPath $iniContent = $iniContent -replace '^Host=.*$', "Host=$ip" Set-Content -Path $iniPath -Value $iniContent Write-Host "Der EDP-Server wurde auf '$ip' gesetzt." -ForegroundColor Green } else { Write-Host "INI-Datei '$iniPath' wurde nicht gefunden." -ForegroundColor Red exit 1 } } # Function to start the EDP application function StartEDP() { if (Test-Path $exePath) { Write-Host "Starte EDP Einsatzleitplatz..." Start-Process $exePath } else { Write-Host "Die Anwendung '$exePath' wurde nicht gefunden." -ForegroundColor Red } } # If a parameter is provided, directly set IP and start EDP if ($DirektIP) { SetHostIP -ip $DirektIP StartEDP exit } # Interactive menu if no parameter was passed Write-Host "`nBitte EDP-Server bestimmen:`n" Write-Host "1 = 192.168.112.10 (ELW RK TUT 50/11-1)" Write-Host "2 = 172.20.2.101 (DRK Spaichingen)" # Write-Host "3 = edp-schulung.drk-spa.de (DRK Schulung)" Write-Host "9 = 127.0.0.1 (Lokaler Server)" Write-Host "" # Get user input $selection = Read-Host "Ihre Auswahl (1 bis 9)" # Map selection to IP address switch ($selection) { "1" { $newIP = "192.168.112.10" } "2" { $newIP = "172.20.2.101" } "3" { $newIP = "edp-schulung.drk-spa.de" } "9" { $newIP = "127.0.0.1" } Default { Write-Host "Ungültige Auswahl. Vorgang abgebrochen." -ForegroundColor Red exit 1 } } # Apply change SetHostIP -ip $newIP # Ask whether to start the EDP app $startChoice = Read-Host "Soll EDP Einsatzleitplatz gestartet werden? (Y/n)" if ($startChoice -in @("Y", "y", "1", "")) { StartEDP } else { Write-Host "EDP wird nicht gestartet." }