Script to insert DNS Server addresses 
Author Message
 Script to insert DNS Server addresses

Hi,

How to I write a script that inputs the Pri & Sec DNS Server addresses ?

Please advise. Thank you



Fri, 23 Dec 2005 10:48:10 GMT  
 Script to insert DNS Server addresses
See your original post

Patience is a virtue you know.

--
Regards,

Michael Holzemer
No email replies please - reply in newsgroup


Quote:
> Hi,

> How to I write a script that inputs the Pri & Sec DNS Server addresses ?

> Please advise. Thank you



Fri, 23 Dec 2005 12:04:20 GMT  
 Script to insert DNS Server addresses
Sorry Mike *blush*....

Just wanted to be sure that I posted on the correct forum...

Cheers!


Quote:
> See your original post

> Patience is a virtue you know.

> --
> Regards,

> Michael Holzemer
> No email replies please - reply in newsgroup



> > Hi,

> > How to I write a script that inputs the Pri & Sec DNS Server addresses ?

> > Please advise. Thank you



Fri, 23 Dec 2005 12:17:55 GMT  
 Script to insert DNS Server addresses
you can use the tool dnscmd.exe from the Microsoft SP3 SupportTools. Execute
it with Wscript.Shell.

lg
Werner



Quote:
> Hi,

> How to I write a script that inputs the Pri & Sec DNS Server addresses ?

> Please advise. Thank you



Fri, 23 Dec 2005 19:07:34 GMT  
 Script to insert DNS Server addresses
Can you be more specific ?


Quote:
> you can use the tool dnscmd.exe from the Microsoft SP3 SupportTools.
Execute
> it with Wscript.Shell.

> lg
> Werner



> > Hi,

> > How to I write a script that inputs the Pri & Sec DNS Server addresses ?

> > Please advise. Thank you



Sat, 24 Dec 2005 16:59:33 GMT  
 Script to insert DNS Server addresses
Maran, I thought this worked for you?

'On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_NetworkAdapterConfiguration where IPEnabled = true")

strIPAddress = Array("192.168.177.200")
strSubnetMask = Array("255.255.255.0")
strGateway = Array("192.168.177.254")
strGatewayMetric = Array(1)
strDNSservers = Array ("192.168.177.200","10.21.25.21","14.21.36.58")

goStatic

Sub goStatic()
For Each objItem In colItems
    errEnable = objItem.EnableStatic(strIPAddress, strSubnetMask)
    errGateways = objItem.SetGateways(strGateway, strGatewaymetric)
    errDNS =  objitem.SetDNSServerSearchOrder()
    errDNS =  objitem.SetDNSServerSearchOrder(strDNSServers)
    If errEnable = 0 Then
        WScript.Echo "The IP address has been changed."
    Else
        WScript.Echo "The IP address could not be changed."
    End If
Next
'// ReQuery to see changes
Set colItems = objWMIService.ExecQuery("Select * from
Win32_NetworkAdapterConfiguration where IPEnabled = true")
For Each objItem In colItems
    If Not IsNull(objitem.ipaddress) Then
  For i = LBound(objitem.IPAddress) To UBound(objitem.IPAddress)
  WScript.Echo "New IP is " & objitem.IPAddress(i)
  Next
 End If
 If Not IsNull(objitem.ipSubnet) Then
  For i = LBound(objitem.IPSubnet) To UBound(objitem.IPSubnet)
  WScript.Echo "New subnet is " & objitem.IPSubnet(i)
  Next
 End If
 If Not IsNull(objitem.DefaultIPGateway) Then
  For i = LBound(objitem.DefaultIPGateway) To
UBound(objitem.DefaultIPGateway)
  WScript.Echo "Gateway is " & objitem.DefaultIPGateway(i)
  Next
 End If
Next
End Sub

This will run an executable and wait for it to complete
Set wshShell  =  wScript.CreateObject("WScript.Shell")
wshShell.Run "%comspec% /c ipconfig",0,true
--
Regards,

Michael Holzemer
No email replies please - reply in newsgroup


Quote:
> Can you be more specific ?



> > you can use the tool dnscmd.exe from the Microsoft SP3 SupportTools.
> Execute
> > it with Wscript.Shell.

> > lg
> > Werner



> > > Hi,

> > > How to I write a script that inputs the Pri & Sec DNS Server addresses
?

> > > Please advise. Thank you



Sun, 25 Dec 2005 01:30:47 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. IS there a way to change DNS and WINS server addresses using Scripts

2. Get IP address and reverse DNS lookup script

3. VBS Script to Create DNS Reverse Lookup Zones in Win2K Server

4. Update DNS, WINS, DNS Suffix with Script -- support VPN users

5. Update DNS, WINS, DNS Suffix with Script -- support VPN users

6. I would like to set my DNS servers via script HELP

7. Who is my dns server? - via script

8. change DNS address for WinXP

9. How To Send DNS Registration after Changing IP Address

10. Add 3 DNS address using WMI

11. checking address through server script

12. How can I get logon server name and IP address from logon script using wsh

 

 
Powered by phpBB® Forum Software