'WMI options, though you need to find out your dns server,,which isnt that hard but..
Set objDNS = GetObject("winMgmts:\\.\root\MicrosoftDNS")
set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")
set objDNSZone = objDNS.Get("MicrosoftDNS_Zone.ContainerName=""" & _
strZone & """,DnsServerName=""" & _
objDNSServer.Name & """,Name=""" & strZone & """")
'ADO method
Set objCmd = CreateObject("ADODB.Command")
'*** get a recordset from active directory of the dns nodes
'*** setup ADODB Command Object, setup ADODB Connection object
strServer = "172.22.8.76"
Set objCon = CreateObject("ADODB.Connection")
objCon.Provider = "ADsDSOObject"
objCon.Open = "Active Directory Provider"
objCmd.ActiveConnection = objCon '*** Create connection
objCmd.Properties("Page Size") = 999 '*** set page size to allow for more than 1000 records
strQuery = "SELECT ADsPath, dc, canonicalName, distinguishedName, objectGUID, name FROM 'LDAP://" & strServer & "' WHERE objectClass = 'dnsZone'"
objCmd.commandtext = strQuery
Set objDNSRecords = objCmd.execute
While Not objDNSRecords.EOF
Wscript.Echo LCase(Trim(Cstr(objDNSRecords.Fields("distinguishedName").Value)))
objDNSRecords.MoveNext
Wend
'WMI ping or dreaded shell
Function LookUp(ByVal strPassed)
Dim objWMIService, colItems, objItem, strTemp, i
Dim WshShell, objExec, strNsLookupStdOut, strLine
strTemp = ""
If strPassed <> "" Then
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_PingStatus " & _
"Where Address = '" & strPassed & "'")
For Each objItem in colItems
strTemp = objItem.ProtocolAddress
Next
Else
strTemp = ""
End If
strTemp = ""
If strTemp <> "" Then
Lookup = strTemp
Else
'i hate myself for doing this, i am a sell out, i have no pride
Set WshShell = CreateObject("WScript.Shell")
Set objExec = WshShell.Exec("nslookup " & strPassed)
'strNsLookupStdOut = objScriptExec.StdOut.ReadAll
Do Until objExec.StdOut.AtEndOfStream
strLine = objExec.StdOut.ReadLine
'Wscript.Echo strLine
If LCase(Left(strLine, Len("name:"))) = "name:" Then
If InStr(strLine, strPassed) Then
Wscript.Echo strLine
strLine = Trim(objExec.StdOut.ReadLine)
Wscript.Echo " & the next one is " & strLine
If LCase(Left(strLine, Len("address:"))) = "address:" Then
For i = 1 To Len(strLine)
If IsNumeric(Mid(strLine, i, 1)) Then
Lookup = Right(strLine, Len(strLine) - i + 1)
Exit For
End If
Next
End If
Exit Do
End If
End If
Loop
'WScript.Echo strNsLookupStdOut
Set objExec = Nothing
Set WshShell = Nothing
End If
End Function