# Changes the DNS servers for a NIC with a specific subnet so it doesn't change another NIC's DNS servers. $computer = Get-Content C:\temp\servers.txt $NICs = Get-WMIObject Win32_NetworkAdapterConfiguration -ComputerName $computer | Where-Object {$_.IPAddress -like "172.16.234.*"} ForEach-Object ($NIC in $NICs) { $NIC.SetDNSServerSearchOrder() $NIC.SetDynamicDNSRegistration(“TRUE”) }