Most of the complication in the function comes in storing all the results into an array that can be used in whatever way you want. The ReDims are necessary as the function never knows how many objects are going to be found...It essentially adds an element to the array for each object.

This line...
 Code:
GetObject("LDAP://"+CreateObject("ADSystemInfo").ComputerName).Parent
simply pulls in the OU of the current computer, which is then used only if an OU is not specified when the function is called.


Edited by ShaneEP (2012-09-01 12:50 AM)