![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | problem with SetDNSServerSearchOrder WMI function uint32 SetDNSServerSearchOrder( [in] string DNSServerSearchOrder[] ); above is copy/paste from msdn site on this function. I keep getting error 70, which means invalid IP address but I know the IP's I'm supplying are fine. The site said that it takes a 'list' of ip addresses but fails to mention how that list should be delimited.. I've tried comma and space and 'or' with no luck, same error every time. here is a snippet of my code, including some temp debugging stuff: ---------------------------------- Dim temp aDNSServers = Array(PrimaryDNS & "," & SecondaryDNS) For Each temp In aDNSServers MsgBox temp Next sQuery = "SELECT MACAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE" set colAdapters = oWMI.ExecQuery(sQuery) For Each oAdapter In colAdapters 'all the NICs in the machine MsgBox "configuring: " & oAdapter.MACAddress iRetVal = oAdapter.SetDNSServerSearchOrder(aDNSServers) If iRetVal = 0 Then msgbox "DNS servers set." Else msgbox "possible error setting dns servers: " & iRetval End If next ------------------------------------- aDNSServers contains 2 ipaddresses delimited by a comma. This has been verified with my debugging msgboxs at runtime. what am I missing here? |
My System Specs![]() |
| | #2 (permalink) |
| | RE: problem with SetDNSServerSearchOrder WMI function I have had problems in the past when trying to set something and using a specific select statement ie "SELECT MACAddress...", but when I have done "SELECT *..." it worked. -J "James" wrote: Quote: > uint32 SetDNSServerSearchOrder( > [in] string DNSServerSearchOrder[] > ); > > above is copy/paste from msdn site on this function. I keep getting error > 70, which means invalid IP address but I know the IP's I'm supplying are > fine. The site said that it takes a 'list' of ip addresses but fails to > mention how that list should be delimited.. I've tried comma and space and > 'or' with no luck, same error every time. > > here is a snippet of my code, including some temp debugging stuff: > ---------------------------------- > > Dim temp > aDNSServers = Array(PrimaryDNS & "," & SecondaryDNS) > For Each temp In aDNSServers > MsgBox temp > Next > > sQuery = "SELECT MACAddress FROM Win32_NetworkAdapterConfiguration WHERE > IPEnabled = TRUE" > > set colAdapters = oWMI.ExecQuery(sQuery) > > For Each oAdapter In colAdapters 'all the NICs in the machine > MsgBox "configuring: " & oAdapter.MACAddress > iRetVal = oAdapter.SetDNSServerSearchOrder(aDNSServers) > > If iRetVal = 0 Then > msgbox "DNS servers set." > Else > msgbox "possible error setting dns servers: " & iRetval > End If > next > ------------------------------------- > > aDNSServers contains 2 ipaddresses delimited by a comma. This has been > verified with my debugging msgboxs at runtime. > > what am I missing here? > > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: problem with SetDNSServerSearchOrder WMI function Thanks for the reply J Ford. I appreciate it. That has happened to me before also and I didn't even think to try that for this one... turned out to not be the issue in this case but I appreciate the good advice none the less. In this case it turns out I'm an idiot (again) this line: aDNSServers = Array(PrimaryDNS & "," & SecondaryDNS) is the problem. Even know I knew the IPs I was supplying were valid I screwed up making the array. Above produces array with one element containing a string with both IP's seperated by the comma. Improper use of the array function. Should be this: aDNSServers = Array(PrimaryDNS, SecondaryDNS) and works fine when it is. "J Ford" <JFord@xxxxxx> wrote in message news:7F2ACC92-FF10-4831-9C19-C3EA98B8F8B2@xxxxxx Quote: >I have had problems in the past when trying to set something and using a > specific select statement ie "SELECT MACAddress...", but when I have done > "SELECT *..." it worked. > > -J > > "James" wrote: > Quote: >> uint32 SetDNSServerSearchOrder( >> [in] string DNSServerSearchOrder[] >> ); >> >> above is copy/paste from msdn site on this function. I keep getting error >> 70, which means invalid IP address but I know the IP's I'm supplying are >> fine. The site said that it takes a 'list' of ip addresses but fails to >> mention how that list should be delimited.. I've tried comma and space >> and >> 'or' with no luck, same error every time. >> >> here is a snippet of my code, including some temp debugging stuff: >> ---------------------------------- >> >> Dim temp >> aDNSServers = Array(PrimaryDNS & "," & SecondaryDNS) >> For Each temp In aDNSServers >> MsgBox temp >> Next >> >> sQuery = "SELECT MACAddress FROM Win32_NetworkAdapterConfiguration WHERE >> IPEnabled = TRUE" >> >> set colAdapters = oWMI.ExecQuery(sQuery) >> >> For Each oAdapter In colAdapters 'all the NICs in the machine >> MsgBox "configuring: " & oAdapter.MACAddress >> iRetVal = oAdapter.SetDNSServerSearchOrder(aDNSServers) >> >> If iRetVal = 0 Then >> msgbox "DNS servers set." >> Else >> msgbox "possible error setting dns servers: " & iRetval >> End If >> next >> ------------------------------------- >> >> aDNSServers contains 2 ipaddresses delimited by a comma. This has been >> verified with my debugging msgboxs at runtime. >> >> what am I missing here? >> >> >> |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| win32_pingstatus and function problem | PowerShell | |||
| Function problem with keyboard | Vista hardware & devices | |||
| Problem using split function | VB Script | |||
| Keyboard second function problem | Vista hardware & devices | |||
| Problem with Vista's sleep function | Vista General | |||