commit ca65b73fcaf5d6abf070ea61fd31e7b2cc8b51fc Author: Tobias.Poetzsch Date: Tue May 20 20:38:14 2025 +0200 Initial version diff --git a/Set-ELP-Host.bat b/Set-ELP-Host.bat new file mode 100644 index 0000000..c7bd5db --- /dev/null +++ b/Set-ELP-Host.bat @@ -0,0 +1,3 @@ +@echo off +powershell.exe -NoProfile -ExecutionPolicy Bypass -File Set-ELP-Host.ps1 +pause diff --git a/Set-ELP-Host.ps1 b/Set-ELP-Host.ps1 new file mode 100644 index 0000000..950a3cf --- /dev/null +++ b/Set-ELP-Host.ps1 @@ -0,0 +1,59 @@ +# Path INI-Datei +$iniPath = "C:\EDP\ELP\ELP.ini" + +# Print menue +Write-Host "Bitte wählen Sie den Zielserver aus:`n" +Write-Host "1 = 192.168.112.10 (ELW)" +Write-Host "2 = 172.20.2.24 (DRK Spaichingen)" +Write-Host "3 = edp-schulung.drk-spa.de (DRK Schulung)" +Write-Host "9 = 127.0.0.1 (Lokaler Server)" +Write-Host "" + +# Read userinput +$wahl = Read-Host "Ihre Auswahl (1, 2, 3 oder 9)" + +# select IP from userinput +switch ($wahl) +{ + "1" + { + $neueIP = "192.168.112.10" + } + "2" + { + $neueIP = "172.20.2.24" + } + "3" + { + $neueIP = "edp-schulung.drk-spa.de" + } + "9" + { + $neueIP = "127.0.0.1" + } + Default + { + Write-Host "Ungültige Auswahl. Vorgang abgebrochen." -ForegroundColor Red + exit + } +} + +# read ini File +if (Test-Path $iniPath) +{ + $iniInhalt = Get-Content $iniPath + + # find line with "Hosts= and replace IP + $iniInhalt = $iniInhalt -replace '^Host=.*$', "Host=$neueIP" + + # Write INI File + Set-Content -Path $iniPath -Value $iniInhalt + + #Print promt + Write-Host "`nDie Host-IP wurde erfolgreich auf '$neueIP' geändert." -ForegroundColor Green +} +else +{ + #Print Errer 404 + Write-Host "Die Datei '$iniPath' wurde nicht gefunden." -ForegroundColor Red +}