Initial commit
Dieser Commit ist enthalten in:
38
scripts/reset-to-dhcp.ps1
Normale Datei
38
scripts/reset-to-dhcp.ps1
Normale Datei
@ -0,0 +1,38 @@
|
||||
# PowerShell Script zum Zurücksetzen auf DHCP
|
||||
# MUSS ALS ADMINISTRATOR AUSGEFÜHRT WERDEN!
|
||||
|
||||
Write-Host "=== Zurücksetzen auf DHCP (automatische IP) ===" -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
|
||||
}
|
||||
|
||||
# Den ersten aktiven WLAN-Adapter nehmen
|
||||
$adapter = $adapters[0]
|
||||
Write-Host "`nSetze Adapter zurück auf DHCP: $($adapter.Name)" -ForegroundColor Cyan
|
||||
|
||||
# Statische IP entfernen
|
||||
Write-Host "`nEntferne statische 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
|
||||
|
||||
# DHCP aktivieren
|
||||
Write-Host "`nAktiviere DHCP..." -ForegroundColor Green
|
||||
Set-NetIPInterface -InterfaceIndex $adapter.InterfaceIndex -Dhcp Enabled
|
||||
|
||||
# DNS auf automatisch setzen
|
||||
Write-Host "`nSetze DNS auf automatisch..." -ForegroundColor Green
|
||||
Set-DnsClientServerAddress -InterfaceIndex $adapter.InterfaceIndex -ResetServerAddresses
|
||||
|
||||
Write-Host "`n✅ Fertig! Der Adapter nutzt jetzt wieder DHCP (automatische IP-Vergabe)" -ForegroundColor Green
|
||||
|
||||
# Kurz warten
|
||||
Start-Sleep -Seconds 3
|
||||
|
||||
# Neue IP anzeigen
|
||||
Write-Host "`nNeue IP-Adresse:" -ForegroundColor Yellow
|
||||
Get-NetIPAddress -InterfaceIndex $adapter.InterfaceIndex -AddressFamily IPv4 | Format-Table IPAddress, PrefixLength
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren