289769a601
Automatic Documentation Deployment / Sync Docs to https://kb.bunny-lab.io (push) Successful in 8s
29 lines
1.3 KiB
Markdown
29 lines
1.3 KiB
Markdown
---
|
|
tags:
|
|
- Networking and Access
|
|
- Change DNS Client Server Settings Remotely
|
|
---
|
|
|
|
## Purpose
|
|
Change the DNS server addresses used by the selected Windows network adapters through PowerShell remoting. This changes client resolver settings rather than records hosted in a DNS zone.
|
|
|
|
!!! info "Run as Domain Admin"
|
|
You need to run the following commands within the context of a powershell session running as a domain admin, otherwise the `Invoke-Command` commands will fail to execute.
|
|
|
|
```powershell
|
|
# Hostname of the Device
|
|
$DEVICE = "DEVICEHOSTNAME"
|
|
|
|
# Iterate List of Network Interfaces Remotely
|
|
Invoke-Command -ComputerName $DEVICE -ScriptBlock { ipconfig /all }
|
|
|
|
# List Current DNS Servers for the selected interface
|
|
Invoke-Command -ComputerName $DEVICE -ScriptBlock { Get-DnsClientServerAddress -InterfaceAlias "Ethernet" } | Select-Object Address
|
|
|
|
# Replace Current DNS Servers for the selected interface
|
|
Invoke-Command -ComputerName $DEVICE -ScriptBlock { Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses ("192.168.3.25","192.168.3.26") }
|
|
```
|
|
|
|
## Related Documentation
|
|
- [Related Networking and Access Documentation](<../../reference/Networking and Access/index.md>) — Find the connected deployments, procedures, and references for this subject.
|