Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - vbscript WINS and DNS

Reply
 
Old 03-31-2009   #1 (permalink)
indytoatl


 
 

vbscript WINS and DNS

I'm trying to add the WINS and DNS entries through vbscript but when I
run the process below
it only inputs the first two WINS addresses. The DNS entries work
fine.

Thanks in advance.


'************************ Begin Script ***************************
Dim objNics
Dim strComputer
Dim strNewDNSServerI1
Dim strNewDNSServerI2
Dim strNewDNSServerI3
Dim strNewDNSServerI4
Dim arrDNSServerOrder
Dim objWMIService


On Error Resume Next

strComputer = "."
strNewDNSServerI1 = "10.10.10.1" 'DNS Search Order - First
strNewDNSServerI2 = "10.10.10.2" 'DNS Search Order - Second
strNewDNSServerI3 = "10.10.10.3" 'DNS Search Order - Third
strNewDNSServerI4 = "10.10.10.4" 'DNS Search Order - Forth

Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objNics = objWMIService.ExecQuery ("SELECT * FROM
Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

For Each nic In objNics
arrDNSServerOrder = nic.DNSServerSearchOrder
nic.SetWINSServer
strNewDNSServerI1,strNewDNSServerI2,strNewDNSServerI3,strNewDNSServerI4

intNewArraySize = 3
ReDim Preserve arrDNSServerOrder(intNewArraySize)

For i = (intNewArraySize - 1) To 0 Step -1
arrDNSServerOrder(i + 1) = arrDNSServerOrder(i)
Next

arrDNSServerOrder(0) = strNewDNSServerI1
arrDNSServerOrder(1) = strNewDNSServerI2
arrDNSServerOrder(2) = strNewDNSServerI3
arrDNSServerOrder(3) = strNewDNSServerI4
intNewDNS = nic.SetDNSServerSearchOrder(arrDNSServerOrder)

Next

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
change all WInS IPs in the enterprise with PowerShell PowerShell
Help with Change DNS/WINS PowerShell script PowerShell
Change wins on remote servers PowerShell
Wins Vista Can't Join into Domain (Wins NT4) Vista networking & sharing
Comparing Vista and XP with Performce Test- XP wins! Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46