Ok, I want to understand this as well as use it, so I hope you don't mind some teaching.

Ok I get this part. Setting the variable
Quote:

Code:

$a = "OU=Users,OU=Some Site,DC=somedc,DC=somedc,DC=somedc,DC=some"






Ok, here you are taking the variable and making it an array (I think) of it's split parts and getting "Ou=Some Site". Does the split start at zero or one? I'm guessing 0 because the second value, which is the one needed, appears to be one here.
Quote:

Code:
 
$DNparts = split($a, ",")
? $DNparts[1]






Ok, I understand what your doing here. Your taking "OU=Some Site" and stripping off the ",OU=" as represented by the "4", as in counting from left to right ",OU=" equals 4 characters.
Quote:

Code:

$sitename = SubStr($DNparts[1], 4)
? $sitename






Ok, I got this I think. This is splitting "Some Site" into "Some" and "Site"
Quote:

Code:
 
$SiteParts = split($sitename)

? $SiteParts[0]
? $SiteParts[1]






This seems a repeat of the section above. What am I missing here?
Quote:

Code:
 
$SiteParts2 = split(SubStr(split($a, ",")[1], 4))

? $SiteParts2[0]
? $SiteParts2[1]






Oh, and one further question. Let say "OU=Some Site" actually looked like this:
OU=Region1 Houston Texas
And I would need SiteParts[0] and SiteParts[1] to be reflected this way:
SiteParts[0] would equal "Region1"
SiteParts[1] would equal "Houston Texas"
Would the space in "Houston Texas" cause problems?

Thanks again for the help.

Regards
Bill