Oh thanks Shane, I was just about to post to say that I have finally found the solution.

If you want to make an official UDF for enumerating computers/users etc in an OU using this coding, I think that would be fantastic. As you can see, I had found your typo by the time that I returned to the kixtart forum. I have also modified your script to remove your last line "get $" as I don't see the point in that line as the script works perfectly without the line.

 Quote:
Dim $objAdsPath, $obj, $filter[0]
$filter[0] = "Computer"
$objADsPath = GetObject("LDAP://OU=IT Suite,OU=Computers,OU=whatever,DC=domain,DC=internal")
If @Error = 0
$objAdsPath.filter = $filter
For Each $obj In $objAdsPath
? $obj.Name
Next
Else
? "Not able to connect to LDAP path."
Endif


Give credits to yourself and to Arend for this script. I think that this should be in an official UDF because I think that this is an incredibly useful function, because in my search for this solution, I came across hundreds of posts asking pretty much the same question.

Before you do that, I have encountered one strange thing. If I run the script on an OU with computers, groups and users etc, it will return only the computers, but when I changed this line
 Quote:
$filter[0] = "Computer"
to read as this
 Quote:
$filter[0] = "User"
, the script runs and it returns the names of all users as expected, BUT it also returns the names of the computers ???? I cannot understand why it returns computers names if the filter is for users.


Edited by Robdutoit (2012-08-31 10:47 PM)
Edit Reason: forgot to remove real domain name