In many circumstance, you may need to isolate application and Active directory issues that may popup because of bad network OR configuration of environment. In one of last challenge to isolate application performance issues with network while retrieving AD object I used following VBScript rather than custom application.
Create a text file eg. RetrieveProxy.vbs in your desired location (mine is c:\tools). Paste following code into notepad.
This will retrieve ‘user1’ proxy address from Active directory.
StartTime=Now REM wscript.echo Starttime Set objUser=GetObject("LDAP://192.168.2.100/CN=user1,OU=Myusers,DC=domain,DC=local") ProxyAddress=objUser.proxyAddresses EndTime=Now TimeTaken=DateDiff("s",StartTime,EndTime) wscript.echo("Proxy Address: "&ProxyAddress", Bind took "&TimeTaken&" Seconds, From "&StartTime&" To "EndTime)
You can run either using command line.
Or by simply double clicking on “RetriveProxy.vbs”.
In above script,
- You can modify the property name you wish to retrieve from AD. I have used “proxyAddress” you can have “whenCreated”, “whenChanged” OR any other available object properties.
- You can change IP OR FQDN of Domain controller. It can be without IP/FQDN as well, Eg. “LDAP:// CN=user1,OU=Myusers,DC=domain,DC=local”, in that case it will connect nearest available domain controller.
- Adding variable ‘StartTime’ OR ‘EndTime’ is completely optional, I have used it so I can see time taken during retrieval so that I can compare it other application doing similar stuff. If it take longer time then expected then definitely some of n/w resources are at fault somewhere.
Following is the modified version so it can run against all objects of an OU (Organizational unit).
StartTime=Now REM wscript.echo Starttime Set objUsers=GetObject("LDAP://192.168.2.100/OU=MyUsers,DC=domain,DC=local") objUsers.Filter = Array("User") Dim AllUsersProxy For Each obj In objUsers AllUsersProxy=AllUsersProxy&obj.cn&" "&obj.proxyAddresses&vbnewline Next EndTime=Now TimeTaken=DateDiff("s",StartTime,EndTime) wscript.echo("Proxy Addresses: "&vbnewline&AllUsersProxy&"Bind took "&TimeTaken&" Seconds, From " &StartTime&" To "&EndTime)
Please note, this script retrieve two properties and output will be new line for each objects.