Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I get all of mt server IP ADDRESS from AD

Status
Not open for further replies.

tbscmgi

MIS
Sep 17, 2003
66
US
To All-
Below is what I have so far, I can only get the server name I need to get the server IP ADDRESS. Is there any way for me to get all the server IP ADDRESS?

----------------------------------------------------------
Sub ShowConnectAD

Dim rootDSE

set rootDSE = Getobject("LDAP://rootDSE")
rootdn = rootDSE.Get("defaultNamingContext")
set objConnection = CreateObject("ADODB.Connection")
set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open = "Active Directory Provider"

End Sub
----------------------------------------------------------
Sub ShowQueryAD

set objCommand.ActiveConnection = objConnection
ObjCommand.CommandText = _
"Select Name, adspath, operatingSystem, machinerole " _
& "from 'LDAP://" & rootdn & "' " _
& "where objectClass = 'computer' and operatingSystem = 'Windows server 2003'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute

End Sub
----------------------------------------------------------
Sub ShowProcessServers()

Dim strComputer

objRecordSet.MoveFirst
Do Until objRecordSet.EOF
strComputer = objRecordSet.Fields("Name").Value
objRecordSet.MoveNext
Loop

End Sub
----------------------------------------------------------
Thanks
 
Resolution of Computer Name to IP address can be done via DNS so you could write an add-on script to ping the server name that your script returns and get the IP Address that way?

--------------------------------------
"Insert funny comment in here!"
--------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top