54 Zeilen
2.5 KiB
PowerShell
54 Zeilen
2.5 KiB
PowerShell
# PowerShell Script für statische IP-Konfiguration
|
|
# MUSS ALS ADMINISTRATOR AUSGEFÜHRT WERDEN!
|
|
|
|
Write-Host "=== Statische IP 192.168.178.88 einrichten ===" -ForegroundColor Green
|
|
|
|
# Aktive WLAN-Adapter finden
|
|
$adapters = Get-NetAdapter | Where-Object {$_.Status -eq 'Up' -and ($_.Name -like '*WLAN*' -or $_.Name -like '*Wi-Fi*')}
|
|
|
|
if ($adapters.Count -eq 0) {
|
|
Write-Host "Kein aktiver WLAN-Adapter gefunden!" -ForegroundColor Red
|
|
exit
|
|
}
|
|
|
|
Write-Host "`nGefundene WLAN-Adapter:" -ForegroundColor Yellow
|
|
$adapters | Format-Table Name, Status, InterfaceIndex
|
|
|
|
# Den ersten aktiven WLAN-Adapter nehmen
|
|
$adapter = $adapters[0]
|
|
Write-Host "`nKonfiguriere Adapter: $($adapter.Name)" -ForegroundColor Cyan
|
|
|
|
# Aktuelle Konfiguration anzeigen
|
|
Write-Host "`nAktuelle IP-Konfiguration:" -ForegroundColor Yellow
|
|
Get-NetIPAddress -InterfaceIndex $adapter.InterfaceIndex -AddressFamily IPv4 | Format-Table IPAddress, PrefixLength
|
|
|
|
# Alte IP-Konfiguration entfernen
|
|
Write-Host "`nEntferne alte IP-Konfiguration..." -ForegroundColor Yellow
|
|
Remove-NetIPAddress -InterfaceIndex $adapter.InterfaceIndex -AddressFamily IPv4 -Confirm:$false -ErrorAction SilentlyContinue
|
|
Remove-NetRoute -InterfaceIndex $adapter.InterfaceIndex -AddressFamily IPv4 -Confirm:$false -ErrorAction SilentlyContinue
|
|
|
|
# Neue statische IP setzen
|
|
Write-Host "`nSetze neue statische IP: 192.168.178.88" -ForegroundColor Green
|
|
New-NetIPAddress -InterfaceIndex $adapter.InterfaceIndex -IPAddress "192.168.178.88" -PrefixLength 24 -DefaultGateway "192.168.178.1" -AddressFamily IPv4
|
|
|
|
# DNS-Server setzen (FRITZ!Box und Google)
|
|
Write-Host "`nSetze DNS-Server..." -ForegroundColor Green
|
|
Set-DnsClientServerAddress -InterfaceIndex $adapter.InterfaceIndex -ServerAddresses "192.168.178.1", "8.8.8.8"
|
|
|
|
# Neue Konfiguration anzeigen
|
|
Write-Host "`nNeue IP-Konfiguration:" -ForegroundColor Green
|
|
Get-NetIPAddress -InterfaceIndex $adapter.InterfaceIndex -AddressFamily IPv4 | Format-Table IPAddress, PrefixLength
|
|
Get-NetRoute -InterfaceIndex $adapter.InterfaceIndex -DestinationPrefix "0.0.0.0/0" | Format-Table DestinationPrefix, NextHop
|
|
|
|
Write-Host "`n✅ Fertig! Ihre IP ist jetzt: 192.168.178.88" -ForegroundColor Green
|
|
Write-Host "Die FRITZ!Box Port-Weiterleitung sollte jetzt funktionieren!" -ForegroundColor Green
|
|
|
|
# Test
|
|
Write-Host "`nTeste Internetverbindung..." -ForegroundColor Yellow
|
|
Test-NetConnection google.com -Port 80 -InformationLevel Quiet
|
|
|
|
if ($?) {
|
|
Write-Host "✅ Internetverbindung funktioniert!" -ForegroundColor Green
|
|
} else {
|
|
Write-Host "❌ Keine Internetverbindung - prüfen Sie die Einstellungen!" -ForegroundColor Red
|
|
} |