Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

i need a script to change DNS and WINS

Thread Tools
 
Search this Thread
 
Old 19 August 2008, 10:52 AM
  #1  
suba
Scooby Regular
Thread Starter
 
suba's Avatar
 
Join Date: Mar 2000
Posts: 2,462
Likes: 0
Received 0 Likes on 0 Posts
Default i need a script to change DNS and WINS

is there a way to run a script to change DNS, DNS suffix and WINS on a PC? i dont know anything about scripting or VB.
Old 19 August 2008, 11:14 AM
  #2  
HankScorpio
Scooby Regular
 
HankScorpio's Avatar
 
Join Date: Feb 2004
Posts: 5,848
Likes: 0
Received 0 Likes on 0 Posts
Default

call a .reg file or do it remotely...?
Old 19 August 2008, 12:03 PM
  #3  
suba
Scooby Regular
Thread Starter
 
suba's Avatar
 
Join Date: Mar 2000
Posts: 2,462
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by HankScorpio
call a .reg file or do it remotely...?
no need to do it remotely. i wasnt sure if DNS and WINS can be done in the .reg. if yes, where are the keys?
Old 19 August 2008, 08:43 PM
  #4  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Default

Done

Last edited by David_Wallis; 20 August 2008 at 03:19 PM.
Old 20 August 2008, 07:49 AM
  #5  
HankScorpio
Scooby Regular
 
HankScorpio's Avatar
 
Join Date: Feb 2004
Posts: 5,848
Likes: 0
Received 0 Likes on 0 Posts
Default

i seem to remember the keys have a unique ID in them but are under HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Param eters
(I think)
you can pick up the uid from another key and plug it into the reg file
Old 21 August 2008, 10:14 PM
  #6  
apalmer
Scooby Regular
iTrader: (8)
 
apalmer's Avatar
 
Join Date: Aug 2007
Posts: 411
Likes: 0
Received 0 Likes on 0 Posts
Default

If its a windows platform mate use netsh...
Old 22 August 2008, 02:06 PM
  #7  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Default

or use the script I wrote to do it

Code:
' Change these values below
' ******************************************** 
strDNS1 = "1.1.1.1" 
strDNS2 = "1.1.1.4"
strWins1= "1.1.1.1" 
strWins2= "1.1.1.4"
strHostName = "dwallis"
strDNSSuffixForConn = "dnssuffixforthisconnection.com"
arrDNSSuffixes = Array("blah.co.uk", "blah.com", "blah.dc.uk.local")
' ******************************************** 

Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set objNICs = objWMIService.InstancesOf( "Win32_NetworkAdapterConfiguration" )
Set objNetworkSettings = objWMIService.Get("Win32_NetworkAdapterConfiguration")

For Each objNIC In objNICs
	If objNIC.IPEnabled Then
		wscript.echo objNic.description
		'If objNIC.DHCPEnabled = False Then
			'If Not IsNull(objNIC.DNSServerSearchOrder) Then ' Display current DNS Settings
				'For Each strDns In objNIC.DNSServerSearchOrder 
				'	wScript.echo objnic.Description &  " DNS" & n & ":" & strDns & " "
				'	n = n + 1
				'Next
			'End If
			objNIC.SetWINSServer strWins1,strWins2
			objNIC.SetDNSServerSearchOrder Array(strDNS1,strDNS2)
		'End If		
	End If
Next

objNetworkSettings.EnableDNS , strDNSSuffixForConn, , arrDNSSuffixes
Old 22 August 2008, 02:18 PM
  #8  
HankScorpio
Scooby Regular
 
HankScorpio's Avatar
 
Join Date: Feb 2004
Posts: 5,848
Likes: 0
Received 0 Likes on 0 Posts
Default

handy!
Old 22 August 2008, 08:24 PM
  #9  
suba
Scooby Regular
Thread Starter
 
suba's Avatar
 
Join Date: Mar 2000
Posts: 2,462
Likes: 0
Received 0 Likes on 0 Posts
Default

me using the script from david. works a treat. excellent.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
KAS35RSTI
Subaru
27
04 November 2021 07:12 PM
Sam Witwicky
Engine Management and ECU Remapping
17
13 November 2015 10:49 AM
Ganz1983
Subaru
5
02 October 2015 09:22 AM
Davalar
General Technical
19
30 September 2015 08:54 PM
Nick_Cat
Computer & Technology Related
2
26 September 2015 08:00 AM



Quick Reply: i need a script to change DNS and WINS



All times are GMT +1. The time now is 09:00 AM.