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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query AD from DMZ using ADSI

Status
Not open for further replies.

Earthworks

IS-IT--Management
Sep 30, 2003
16
0
0
GB
I'm trying to query the domain active directory (AD) from a DMZ. The firewall is open for port 389. Once I move my script from the domain into the DMZ it no longer works.

Are there additional ports that require opening on the firewall?

I've tried replacing LDAP://DC=doaminname,DC=com with LDAP://10.1.1.22 i.e. the IP address of a domain controller that the firewall port is opened for.

Here's the script:

'---------------------------------------------------------------
' Returns the name a for all the user accounts in
' Active Directory.
'---------------------------------------------------------------
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 from 'LDAP://DC=doaminname,DC=com' " & "where objectClass='user'"

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

Wscript.Echo "User Name: " & objRecordSet.Fields("Name").Value

objRecordSet.MoveNext
Loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top