Hello,
Do you want it to work with Powershell v3 for Windows 2012 and Windows 2008(R2) ?
In any case, you can try this (not tested)
Function Set-DNSServer {
param (
[IpAddress]$DNSServer,
[IpAddress]$NicIP
)
Get-WmiObject Win32_NetworkAdapterConfiguration | ? { $_.IPEnabled -eq "TRUE" } | % {
if ($_.IpAddress -eq $NicIP) {
$x = $IP.SetDNSServerSearchOrder($DNSServer)
}
}
}
Regards