ADpathFind
Top  Previous  Next


Finds out ADpath for an object from any unique Active Directory property

An empty string is returned if there are no match or more than one match (first three matches are displayed in log window).

Use the AD path with AD commands such as AD.Account.SetProperty

ADpathFind (Container, ObjectType, SearchFilter, IncludeSubContainers)

Container
Full AD path to container to search  

ObjectType
Type of object to find  
Options: User | Group | Computer | Contact  

SearchFilter
Format: property=value  
 
Examples  
SearchFilter
Description
cn=steve
The object "steve".
telephonenumber=123456
The object with telephone number "123456".
email=steve@acme.com
The object with email "steve@acme.com"
 
 
The easiest way to find out correct property names for accounts is probably to use SetupExplorer, see How to display all existing properties for one account.  

IncludeSubContainers

Options: Yes | No  
·Yes - objects in subcontainers should be included in search  
·No - objects in subcontainers should not be included in search  

Examples
Find ADpath from telephone number

Set
 ObjectPath=ADpathFind (dc=com/dc=acme/dc=d31,user,telephonenumber=12343242,Yes)
If "%ObjectPath%"<> Then
 MessageBox %ObjectPath%   
Else   
 MessageBox Not found
EndIf

Find ADpath from telephone number, use ADpath to find out account expiration date

Set
 ObjectPath=ADpathFind (dc=com/dc=acme/dc=d31,user,telephonenumber=12343242,Yes)   
If "%ObjectPath%"<> Then   
 Set Expires=ADValue (ADPath,%ObjectPath%,accountExpires)   
 MessageBox %Expires%   
Else   
 MessageBox ADpath not found   
EndIf