Jump to content
Sign in to follow this  

Help with Active Directory!

Recommended Posts


Hello everybody, I have an issue with active Directory, here is the thing:

I need to work with 2 objects in Active Directory: User Object and Contact Object. I used this code for get all the attributes I need from user object:

$strCategory = "person"
$path = "dc=na,dc=company,dc=domain"
$field = "SamAccountName"
$strUserName = "*"
$objConnection = ObjCreate("ADODB.Connection")
$objConnection.Open ("Provider=ADsDSOObject;")
$objCommand = ObjCreate("ADODB.Command")
$objCommand.ActiveConnection = $objConnection
$objCommand.CommandText = "<LDAP://"& $path &">;(&(objectCategory=" & $strCategory & ")" & "("& $field & "=" & $strUserName & "));altRecipient;Subtree"
$objRecordSet = $objCommand.Execute

With this as I said I can manipulate all the atributtes in "users object".Now my question is, what I need to modify in this code in order to have access to "Contacts Object" attributes. I believe I need to change the $strCategory, and $field variables, but I don't know the name I should use in Active Directory to Specify I want to get "contacts Object" attributes. :)

Pleaseee Help!!!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.