|
Am trying to change DNS search order
$strComputer = "." $objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"+$strComputer+"\root\cimv2") $DNSAdapterSet = $objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE AND Description<>'PPP Adapter.' AND Description<>'Windows NT Remote Access WAN Wrapper'") Dim $DNSip[4] $DNSip[1] = '157.54.164.1' $DNSip[2] = '157.54.164.2' $DNSip[3] = '157.54.164.3' $DNSip[4] = '157.54.164.4'
For Each $DNSAdapter In $DNSAdapterSet
$result = $DNSAdapter.SetDNSServerSearchOrder($DNSip)
If $result = 0 $null = MessageBox(@SERROR+"["+$result+"]", $DNSAdapter.IPAddress(0), 16) Else $null = MessageBox("IP Change failed."+" "+$result, $DNSAdapter.IPAddress(0), 16) EndIf Next
and i get COM exception error "SetDNSServerSearchOrder" (SWbemObject - Type mismatch ) [-2147352567/80020009]
Any ideas?
(This Board is just wonderfull)
|