Update ip-settings.ps1

added custom DNS (4)
This commit is contained in:
Dejan 2026-02-20 10:49:05 +00:00
parent 95c220fdd7
commit e79773a42f

View file

@ -66,6 +66,7 @@ Write-Host " Profiles:" -ForegroundColor White
Write-Host " [1] Camera Control -> 192.168.178.22 /24 GW: 192.168.178.1 DNS: 192.168.178.10 / 192.168.178.14" -ForegroundColor White Write-Host " [1] Camera Control -> 192.168.178.22 /24 GW: 192.168.178.1 DNS: 192.168.178.10 / 192.168.178.14" -ForegroundColor White
Write-Host " [2] LAN Profile 2 -> 192.168.1.222 /24 GW: 192.168.1.1 DNS: Automatic" -ForegroundColor White Write-Host " [2] LAN Profile 2 -> 192.168.1.222 /24 GW: 192.168.1.1 DNS: Automatic" -ForegroundColor White
Write-Host " [3] DHCP (automatic) DNS: Automatic" -ForegroundColor White Write-Host " [3] DHCP (automatic) DNS: Automatic" -ForegroundColor White
Write-Host " [4] DHCP (automatic) DNS: 192.168.178.10 / 192.168.178.14" -ForegroundColor White
Write-Host "" Write-Host ""
$profileChoice = Read-Host " Enter profile number" $profileChoice = Read-Host " Enter profile number"
@ -113,6 +114,18 @@ elseif ($profileChoice -eq "3") {
Write-OK " IP : Automatic" Write-OK " IP : Automatic"
Write-OK " DNS : Automatic" Write-OK " DNS : Automatic"
} }
elseif ($profileChoice -eq "4") {
$dns1 = "192.168.178.10"
$dns2 = "192.168.178.14"
Set-NetIPInterface -InterfaceIndex $nicIdx -Dhcp Enabled
Set-DnsClientServerAddress -InterfaceIndex $nicIdx -ServerAddresses ($dns1, $dns2) | Out-Null
Write-OK "Adapter '$nicName' switched to DHCP with custom DNS"
Write-OK " IP : Automatic"
Write-OK " DNS 1 : $dns1"
Write-OK " DNS 2 : $dns2"
}
else { else {
Write-Err "Invalid profile choice. No changes made." Write-Err "Invalid profile choice. No changes made."
Read-Host "Press Enter to exit" Read-Host "Press Enter to exit"