|
windows
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Need help fixing network changes scripted in an Ed Wilson bookIf this is the wrong newsgroup for this question, please direct me to some more appropriate microsoft.public newsgroups. On a WXP SP2 Home system with WiFi access to the internet through a router connected to a cable modem, I foolishly ran some VBScripts from the Ed Wilson book "Microsoft Windows Scripting Self-Paced Learning Guide". Shortly thereafter, I found that this system could no longer access the internet. My learning pace has ground to a halt, and so far, I can't find where Ed may have provided scripts to undo the system changes made by the scripts in his book. The symptoms are that I can ping localhost, but pinging the computer's name tells me it is attempting to ping 192.168.1.102, but all requests time out. When I attempt to use IE to access an internet URL, I get a page that ends with: Cannot find server or DNS Error Internet Explorer When booted into safe mode, or from an OS installed in a different partition, pinging the computer's name succeeds and the internet can be accessed. I have not attempted to to connect to the router through a Cat 5 cable. I have searched the internet for how to recover from changes made by the scripts in this book, with no success. I realize I can probably fix things by restoring from a restore point, but I'd like to make this a learning experience. Here is what I think is the problematic script: Option Explicit Dim target Dim oWMIService Dim colNetAdapters Dim oNetAdapter Dim DNSDomainErr Dim DNSsearchErr Dim DNSServer Target = "." DNSserver=Array("128.1.2.1", "129.1.2.2") Set oWMIService = GetObject("winmgmts:\\" & target & "\root\cimv2") Set colNetAdapters = oWMIService.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") For Each oNetAdapter In colNetAdapters DNSDomainErr = oNetAdapter.SetDNSDomain("NWTraders.com") DNSsearchErr=oNetAdapter.SetDNSServerSearchOrder(DNSserver) WScript.Echo "DNSDomain returned " & (DNSDomainErr) WScript.Echo "DNSsearchOrder returned " & (DNSsearchErr) Next I suspect that one or both of the following two lines made a change that has screwed up my internet access: DNSDomainErr = oNetAdapter.SetDNSDomain("NWTraders.com") DNSsearchErr=oNetAdapter.SetDNSServerSearchOrder(DNSserver) I'm hoping to fix my problem by changing "NWTraders.com" to an empty string and DNSserver to an empty array, and running the script again. But first I'd like to understand what effect each of these lines should have on a WXP Home system. I've read URL http://msdn.microsoft.com/en-us/library/aa393294(VS.85).aspx, which basically says: The SetDNSDomain WMI class method allows for the setting of the DNS domain. This is an instance-dependent method call that applies on a per-adapter basis. The setting applies to the targeted adapter. [the argument is] Domain with which the DNS is associated, represented by an organization name followed by a period and an extension that indicates the type of organization. It gives no information as to what the effect of changing from an empty string to something like "NWTraders.com" might be. Similarly, http://msdn.microsoft.com/en-us/library/aa393295(VS.85).aspx talks about the SetDNSServerSearchOrder method, but nothing about what the effects of changing from an empty array to something like Array("128.1.2.1", "129.1.2.2") might be. I'm hoping that someone can advise me on whether changing "NWTraders.com" to an empty string and DNSserver to an empty array, and running the script again are likely to fix my problems, or can provide URL or book references or brief explaination in layman's terms as to how changes to these properties affect how WXP Home accesses the internet. Thanks for any help you can give me. -Paul Randall Paul Randall wrote:
Show quoteHide quote > Hi, Well, in layman's terms....> > If this is the wrong newsgroup for this question, please direct me to some > more appropriate microsoft.public newsgroups. > > On a WXP SP2 Home system with WiFi access to the internet through a router > connected to a cable modem, I foolishly ran some VBScripts from the Ed > Wilson book "Microsoft Windows Scripting Self-Paced Learning Guide". > Shortly thereafter, I found that this system could no longer access the > internet. > > My learning pace has ground to a halt, and so far, I can't find where Ed may > have provided scripts to undo the system changes made by the scripts in his > book. > > The symptoms are that I can ping localhost, but pinging the computer's name > tells me it is attempting to ping 192.168.1.102, but all requests time out. > When I attempt to use IE to access an internet URL, I get a page that ends > with: > Cannot find server or DNS Error > Internet Explorer > > When booted into safe mode, or from an OS installed in a different > partition, pinging the computer's name succeeds and the internet can be > accessed. I have not attempted to to connect to the router through a Cat 5 > cable. > > I have searched the internet for how to recover from changes made by the > scripts in this book, with no success. I realize I can probably fix things > by restoring from a restore point, but I'd like to make this a learning > experience. > > Here is what I think is the problematic script: > Option Explicit > Dim target > Dim oWMIService > Dim colNetAdapters > Dim oNetAdapter > Dim DNSDomainErr > Dim DNSsearchErr > Dim DNSServer > > Target = "." > DNSserver=Array("128.1.2.1", "129.1.2.2") > Set oWMIService = GetObject("winmgmts:\\" & target & "\root\cimv2") > Set colNetAdapters = oWMIService.ExecQuery _ > ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") > For Each oNetAdapter In colNetAdapters > DNSDomainErr = oNetAdapter.SetDNSDomain("NWTraders.com") > DNSsearchErr=oNetAdapter.SetDNSServerSearchOrder(DNSserver) > WScript.Echo "DNSDomain returned " & (DNSDomainErr) > WScript.Echo "DNSsearchOrder returned " & (DNSsearchErr) > Next > > I suspect that one or both of the following two lines made a change that has > screwed up my internet access: > > DNSDomainErr = oNetAdapter.SetDNSDomain("NWTraders.com") > DNSsearchErr=oNetAdapter.SetDNSServerSearchOrder(DNSserver) > > I'm hoping to fix my problem by changing "NWTraders.com" to an empty string > and DNSserver to an empty array, and running the script again. But first > I'd like to understand what effect each of these lines should have on a WXP > Home system. I've read URL > http://msdn.microsoft.com/en-us/library/aa393294(VS.85).aspx, which > basically says: > > The SetDNSDomain WMI class method allows for the setting of the DNS domain. > This is an instance-dependent method call that applies on a per-adapter > basis. The setting applies to the targeted adapter. > > [the argument is] Domain with which the DNS is associated, represented by an > organization name followed by a period and an extension that indicates the > type of organization. > > It gives no information as to what the effect of changing from an empty > string to something like "NWTraders.com" might be. > > Similarly, http://msdn.microsoft.com/en-us/library/aa393295(VS.85).aspx > talks about the SetDNSServerSearchOrder method, but nothing about what the > effects of changing from an empty array to something like Array("128.1.2.1", > "129.1.2.2") might be. > > I'm hoping that someone can advise me on whether changing "NWTraders.com" to > an empty string and DNSserver to an empty array, and running the script > again are likely to fix my problems, or can provide URL or book references > or brief explaination in layman's terms as to how changes to these > properties affect how WXP Home accesses the internet. > > Thanks for any help you can give me. > > -Paul Randall Problem: "I did X and now Y does not work"? Solution: "use System restore" Regards, -- pa |
|||||||||||||||||||||||