deliyurek007
Vendor
Hi Guys,
I have a script that change your network interface card withe the DNS entry what do you want.
But the problemm is If i have 2 a 4 network card on my server it will be changed like the first or second card but not all the cards are configurered with the Primary and Secondery DNS interface sometimes the first and second card has been used like extrenal adress not internal. Is it possible to put entry's on the script like If you find or defined or configurered like 192.168.1.2 / 192.168.1.3 change to that adress what has been definied on the script.
It is more check before it changed.
See the script what i have.:
************************
' create objects
Set objWshShell = WScript.CreateObject("Wscript.Shell")
' Network Info
arrDNSServers = Array ("192.168.0.3","192.168.0.4")
strComputer = "."
'For more than one computer open up file
'and loop
'read computer name
Change_DNS_Address strComputer, arrDNSServers
'end loop
'--------------------------------------------
Sub Change_DNS_Address (strComputer, arrDNSServers)
'Make connection
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Get Network Cards from WMI
Set colNicConfigs = objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
' Sets DNS #s for each NIC
For Each objNicConfig In colNicConfigs
intStaticReturn = objNicConfig.EnableStatic(arrIPAddresses, arrSubnetMasks)
Set objNicChanged = objWMIService.Get("Win32_NetworkAdapterConfiguration.Index=" & objNicConfig.Index)
intDNSServers = objNicChanged.SetDNSServerSearchOrder(arrDNSServers)
Next
--*******************
Maybe some body nows how can i put the rule to look at it and chaged it. Does have anybody a solution for that.
I have a script that change your network interface card withe the DNS entry what do you want.
But the problemm is If i have 2 a 4 network card on my server it will be changed like the first or second card but not all the cards are configurered with the Primary and Secondery DNS interface sometimes the first and second card has been used like extrenal adress not internal. Is it possible to put entry's on the script like If you find or defined or configurered like 192.168.1.2 / 192.168.1.3 change to that adress what has been definied on the script.
It is more check before it changed.
See the script what i have.:
************************
' create objects
Set objWshShell = WScript.CreateObject("Wscript.Shell")
' Network Info
arrDNSServers = Array ("192.168.0.3","192.168.0.4")
strComputer = "."
'For more than one computer open up file
'and loop
'read computer name
Change_DNS_Address strComputer, arrDNSServers
'end loop
'--------------------------------------------
Sub Change_DNS_Address (strComputer, arrDNSServers)
'Make connection
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Get Network Cards from WMI
Set colNicConfigs = objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
' Sets DNS #s for each NIC
For Each objNicConfig In colNicConfigs
intStaticReturn = objNicConfig.EnableStatic(arrIPAddresses, arrSubnetMasks)
Set objNicChanged = objWMIService.Get("Win32_NetworkAdapterConfiguration.Index=" & objNicConfig.Index)
intDNSServers = objNicChanged.SetDNSServerSearchOrder(arrDNSServers)
Next
--*******************
Maybe some body nows how can i put the rule to look at it and chaged it. Does have anybody a solution for that.