This will loop through your Domain looking for computers running DNS. I use
WMI, which may be slower than just shelling out doing something like
srvinfo. But it works for me
'''''''''''''''''''''''''''''''BEGIN''''''''''''''''''''''''''''''''
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, Location from 'LDAP://DC=Mydomain,DC=com"_
& "where objectClass='computer'"
'If you want to do the query in a Child Domain, then replace
'LDAP://DC=Mydomain,DC=com" with
'LDAP://DC=myChildDomain,DC=Mydomain,DC=com"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
ComputerName = objRecordSet.Fields("Name").Value
Call DoEnum(ComputerName)
objRecordSet.MoveNext
Loop
Set objRecordSet = Nothing
Set objCommand = Nothing
Set objConnection = Nothing
Sub DoEnum(ComputerName)
On Error Resume Next
strComputer = ComputerName
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery _
("Select * from Win32_Service")
For Each objService in colListOfServices
If instr(UCASE(objService.DisplayName), UCASE("DNS Server")) >0 Then
Wscript.Echo(objService.SystemName) & " is running " &
objService.DisplayName & ". The Service is " & objService.State
End If
Next
End Sub
'''''''''''''''''''''''''''''''END''''''''''''''''''''''''''''''''
HTH
--
Sincerely,
Dèjì Akómöláfé, MCSE MCSA MCP+I
www.akomolafe.com
www.iyaburo.com
Do you now realize that Today is the Tomorrow you were worried about
Yesterday? -anon