How do I set the DNS address for a network adapter programmatically in Windows Server 2008? It looks like Set-DnsClientServerAddress
isn't supported.
How do I set the DNS address for a network adapter programmatically in Windows Server 2008? It looks like Set-DnsClientServerAddress
isn't supported.
It's not possible to do this via PowerShell (the docs aren't explicit about this, but you can see Server 2008 is not listed at the top of the page), but you can use
netsh
:Since you asked for PowerShell, you can use WMI and set it via the
Win32_NetworkAdapterConfiguration
provider:This will list the adapters you have, then you can select a specific one:
Then you use the
SetDNSServerSearchOrder()
method to to set the address(es):Bonus one-liner: