ja, that UDF is sad show.
it probably would be just some lines for this task if someone else would have written it [Wink]

anyway, the WMI way I have partly generated.
I was able to lock myself offline with this:
$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$DNSAdapterSet = $objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE AND Description<>'PPP Adapter.' AND Description<>'Windows NT Remote Access WAN Wrapper'")

For Each $DNSAdapter In $DNSAdapterSet
$method = $DNSAdapter.Methods_.Item("SetDNSServerSearchOrder")
$inParam = $method.inParameters.SpawnInstance_()
; INPARAM property needed here.
$outParam = $DNSAdapter.ExecMethod_("SetDNSServerSearchOrder",$inParam)
next


dunno what inparam property I should put there.
anyway, my ironic note about the UDF (which you understood to point to registry stuff in it) was a pointer for you to try descripe a little more specific question [Wink]
_________________________
!

download KiXnet