LDAP Query Help VBScript
Posted on 2005-04-26
I am pretty new to VBScripting and I want to play around a little bit. I hope you guys can help me...
1) I want a script which checks an entire OU (EMEA, Main, Spain) and in the given OU it checks each users and outputs the username, full name and tel. number into a CSV file IF the phone number starts with +34. So far I could do it on a user level however this is not what I want. Also this is a full name and not the userID. The LDAP query I came up with is: "LDAP://cn=Doe\, John,ou=Spain,OU=Main,OU=EMEA,DC=sub,DC=domain,DC=com" This does work for that specific user.
2) I want the same script, however then accepting a userID - so for example: cscript findtel.vbs "jdoe1" it should then search in my AD (40.000+ accounts) in all OU's and then again display the output (thus not to file).
So I am looking for 2 scripts on how I can manage this. I know I am asking for a pre-cooked script, however my intention is to study that on how it works, so comments are appreciated. Best answer is worth 500 points.
Thanks for your assistance