DNS Suffix Search Order

Home Forums Scripting Windows Script Host DNS Suffix Search Order

Viewing 1 post (of 1 total)
  • Author
  • Avatar

    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
    On Error Resume Next
    strDNSServerSearchOrder = Join(objNetCard.DNSServerSearchOrder, “,”)

    objReport.WriteLine strComputer & “,” & strIP & “,” & strDNSServerSearchOrder


Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.