DNS Suffix Search Order
- This topic has 2 replies, 3 voices, and was last updated 9 years, 9 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.
Home › Forums › Scripting › Windows Script Host › DNS Suffix Search Order
Can someone help me write a simple vbscript pull the DNS Suffix Search Order from multiple servers using a file (e.g. servers.txt) and output file to my server with the following extension (i.e. txt, csv or xls)
‘So far here’s what I have, see below. But this script reports the ‘DNSSearchOrder and Not the DNSSuffixSearchOrder. Can someone help.
Const ForWriting = 2
arrComputers = Array(“Server1, Server2”)
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objReport = objFSO.CreateTextFile(“dnsreport.csv”, ForWriting)
objReport.WriteLine “Server Name,IP Address,Preferred DNS,Alternate DNS”
For Each strComputer in arrComputers
Set objWMIService = GetObject(“winmgmts:\” & strComputer & “rootcimv2”)
Set colNetCards = objWMIService.ExecQuery _
(“Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True”)
For Each objNetCard in colNetCards
For Each objAddress in objNetCard.IPAddress
strIP = objAddress
Next
On Error Resume Next
strDNSServerSearchOrder = Join(objNetCard.DNSServerSearchOrder, “,”)
Next
objReport.WriteLine strComputer & “,” & strIP & “,” & strDNSServerSearchOrder
Next
objReport.Close
You must be logged in to reply to this topic.
Find out more about our cookie policy here.