Login | |
|
 |
RE: Invalid Method error when trying to use SetDNSSuffi... - 3/27/2006 5:19:59 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
I am not a member and I am not logged in. I see the huge orange button too. Just scroll down and you will see the discussion of the issue. Did you try scrolling down at all?
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Invalid Method error when trying to use SetDNSSuffi... - 3/28/2006 2:49:46 AM
|
|
 |
|
| |
tboneking720
Posts: 6
Score: 0
Joined: 3/27/2006
Status: offline
|
Of course I tried scrolling down! I find your line of questioning insulting, but besides all that, it turns out it's a glitch in the link. I viewed the page from a computer on a different network, and the rest of the page showed up. Before, it stopped at the orange "ASK AN EXPERT NOW" link. I just went back to the same page, and now the discussion is gone again. :/ In any case, it doesn't answer the question of how to pass arrays of strings into a method. I've tried using the array("string1","string2") before, but with no luck. It keeps the variant typename, and the program gives me an error. Thanks, Greg Turnipseed PS-sorry to be blunt, but your arguing with me as to whether the discussions exist or not is certainly not helpful to me, and accusing me of not taking the time to scroll down (which is, of course, the first thing I did...) insults me.
< Message edited by tboneking720 -- 3/28/2006 2:53:53 AM >
|
|
| |
|
|
|
 |
RE: Invalid Method error when trying to use SetDNSSuffi... - 3/28/2006 2:56:32 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
My apologies for insulting you. I was simply confused since the entire discussion was right there plain as day for me. Here is what I found to be pertinent: Comment from TheMCSE Date: 02/09/2003 09:14AM PST Comment Per the following MS documentation, the SetDNSSuffixSearchOrder method is specific to WinNT4. The DNSDomainSuffixSearchOrder property should provide the functionality that you desire. It looks like it accepts an array of strings for setting this property. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_networkadapterconfiguration.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/setdnssuffixsearchorder_method_in_class_win32_networkadapterconfiguration.asp http://www.microsoft.com/technet/treeview/default.asp?url=/technet/ScriptCenter/network/ScrNet12.asp Good luck. Comment from stefri Date: 02/09/2003 09:47AM PST Author Comment I realized that for Windows-NT-only was specified...... Is getting DNSDomainSuffixSearchOrder as follow will be successfull? domSuff = colAdapt.DNSDomainSuffixSearchOrder for i = 0 to ubound(domSuff) wscript.echo domSuff(i) next To clear: domSuff = array("") myErr = colAdapt.DNSDomainSuffixSearchOrder (domSuff) To set: domSuff = array("aa.bb.cc.com", "bb.cc.com", "cc.com") myErr = colAdapt.DNSDomainSuffixSearchOrder (domSuff) stefri Comment from TheMCSE Date: 02/09/2003 10:16AM PST Comment For getting the information, what you have should work. domSuff = colAdapt.DNSDomainSuffixSearchOrder for each item in domSuff MsgBox item next I just noticed in the link I posted earlier that the DNSDomainSuffixSearchOrder is a read-only property. I think that I would resort to modifying the registry (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\SearchList) to clear and set new suffix search order. '******************************************************** Option Explicit ' On Error Resume Next Const DESIRED_SEARCH_ORDER = "a.com,b.com,c.com,d.com" ' registry expects comma delimited Dim objWSHShell, strValue Set objWSHShell = WScript.CreateObject("WScript.Shell") strValue = objWSHShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\SearchList") MsgBox "Your current DNS suffix search order contains: " & strValue & ".", vbInformation, "Current search order" objWSHShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\SearchList", "" strValue = objWSHShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\SearchList") MsgBox "Your current DNS suffix search order contains: " & strValue & ".", vbInformation, "Current search order" objWSHShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\SearchList", DESIRED_SEARCH_ORDER strValue = objWSHShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\SearchList") MsgBox "Your current DNS suffix search order contains: " & strValue & ".", vbInformation, "Current search order" Comment from stefri Date: 02/09/2003 10:23AM PST Author Comment A little more efforts and I double the points... Could this be set in netlogon or whatever in such a way that changes are applied once and only once for all domain users when they will connect the firqt time. We are migrating to e2k and changing fixed IP address to DHCP, etc.... Stefri Accepted Answer from TheMCSE Date: 02/09/2003 01:23PM PST Grade: A Accepted Answer Do your users have administrative permissions to the local machines? If not, how do you plan on allowing the script to execute. Excluding this one small detail, you could easily set a flag on the loal machine (in the filesystem?) to indicate whether the script had been executed. A better way may be to put all of the code that you have for making the conversion into a sub and check one of the values that would be changed. If it were all in a sub named ChangeNetSettings(), you could have something like this: '********************************************************* Sub ChangeNetSettings() ' Convert to DHCP, modify DNS, etc. End Sub Set objWSHShell = WScript.CreateObject("WScript.Shell") On Error Resume Next strValue = objWSHShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\SearchList") If strValue = "" Or strValue <> "a.com,b.com,c.com,d.com" Then ChangeNetSettings() Comment from stefri Date: 02/10/2003 12:43AM PST Author Comment Thanks for your help. users will have permissions (unfortunately... otherwise there will 1500 PC to modify unless you have a suggestion for this small detail...as you say) Follow this link: http://www.experts-exchange.com/Operating_Systems/Win2000/Q_20507140.html where more points are available Stephane Comment from stefri Date: 02/10/2003 04:28AM PST Author Comment TheMCSE, While browsing MSN, found this [Visual Basic] The EnableDNS WMI class static method enables the Domain Name System (DNS) for service. Function EnableDNS( _ [ ByVal DNSHostName As String ], _ [ ByVal DNSDomain As String ], _ [ ByVal DNSServerSearchOrder() As String ], _ [ ByVal DNSDomainSuffixSearchOrder() As String ] _ as integer To clear: dnsSrch = array("") domSuff = array("") myErr = colAdapt.EnableDNS(,,dnsSrch ,domSuff) To Set: dnsSrch = array("172.0.0.1","172.1.0.1") domSuff = array("a.b.com", "b.com") myErr = colAdapt.EnableDNS(,,dnsSrch ,domSuff) Will solve my problem? Comment from TheMCSE Date: 02/10/2003 05:53AM PST Comment Yes, this is definitely the correct way to use WMI to modify your DNS domain suffix search order. You will have to adjust your code slightly to use this, as the EnableDNS method is called against the class (Win32_NetworkAdapterConfiguration). Good luck. sample at http://cwashington.netreach.net/depo/view.asp?Index=594&ScriptType=vbscript '********************************************************** dnsSuff = array("aa.bb.com", "bb.com") Set objClass = GetObject("WinMGMTS:Win32_NetworkAdapterConfiguration") objClass.EnableDNS ,,,dnsSuff
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
|
|