Here's what I ended up with. This is code I feel comfortable with and I exactly understand what is does. I'm not a COM guru so that’s quite an achievement \:\)

The code requires the TranslateName() and a modified version of the InContainer() UDF. See the second code section in this post for the modiefied InContainer() UDF.

 Code:
Break on

$countries = "Belgium", "Corporate", "France", "Germany", "Italy", "Spain", "Switzerland", "The Netherlands"

;Get all users from the current domain.
$oDomain = GetObject("WinNT://@LDomain")
$oDomain.filter = "User", ""

For Each $oUser in $oDomain
	If $oUser.AccountDisabled = "0"
		$namearray = Split($oUser.Fullname, ",")
		If UBound($namearray) > 0
			For $i = 0 to UBound($namearray)
				$namearray[$i] = Trim( $namearray[$i])
			Next
			$fullname = $namearray[1] + " " + $namearray[0]
			For Each $country in $countries
				$rc = InContainer("OU=" + $country + ",OU=companyname_ou,DC=SubDomain,DC=Domain,DC=Ext", "User", $oUser.name)
				If $rc[0] = "1" Or $rc[0] = "2"
					MD "\\Server\Share\" + $fullname
				EndIf
			Next
		EndIf
	EndIf
Next


Modified InContainer() UDF:
 Code:
;FUNCTION InContainer()
;
;AUTHOR
;			Howard A. Bullock (hbullock@tycoelectronics.com)
;
;VERSION
;			1.6
;
;DATE
;			20-Mar-2002
;REVISED
;			04-Apr-2005
;			08-Apr-2009 - Mart - Added userid parameter.
;
;ACTION
;			Determines if the current NT4 account name type is a member of a specific container (OU, Computers, etc)
;			in Active Directory
;
;SYNTAX
;			InContainer ($Container, $NameType, $userid)
;
;PARAMETERS
;			$Container (Required)
;				-  String value
;				Dinstinghished name of the container to check. This must be the fully qualified DN to
;				accurately make a determination.
;
;			$NameType (Required)
;				-  String value
;				"Computer" or "User" are currently the only valid values
;
;			$Userid (Optional)
;				- The username to check.
;				If none is specified @userid is assumed.
;
;REMARKS
;			This function returns true if the object being checked in the the specified container
;			or a child container of that specified.
;
;RETURNS
;			An ARRAY of three values:
;			InContainer return code
;				1 = object is a member of the exact container specified.
;				2 = object is a member of the container hierarchy.
;				0 = object is not a member of the container hierarchy.
;				-1 = Invalid input for $NameType
;				-2 = Error in TranslateName
;				TranslateName ErrorCode
;				TranslateName ErrorText
;
;DEPENDENCIES
;			OS: Active Directory aware client
;			Other Functions: TranslateName()
;
;EXAMPLES
;			$rc = InContainer ("OU=test,OU=9826,OU=NCS,OU=Machines,DC=us,DC=tycoelectronics,DC=com", "Computer")
;			select
;				case $rc[0]=1
;					? "object is a member of the specified container."
;				case $rc[0]=2
;					? "object is a member of a child container lower in the hierarchy."
;				case $rc[0]=0
;					? "object is NOT a member of this container or a child of this container."
;				case $rc[0]=-1
;					? "InContainer() Error - Invalid input for $NameType "
;				case $rc[0]=-2
;					? "TranslateName() Error"
;				case 1
					;? "Unknown return code"
;			endselect
;
Function InContainer($Container, $NameType, optional $userid)
	Dim $CurrentContainer, $Name1, $Name2, $Found, $commaloc
	
	If Trim($userid) = ""
		$userid = @USERID
	EndIf
	
	Select
		Case $NameType = "Computer" $Name1 = @Domain + "\" + @wksta + "$$"
		Case $NameType = "User" $Name1 = @LDomain + "\" + $userid
		;Case $NameType = "User" $Name1 = @LDomain + "\" + @UserID
		Case 1 $Name1 = ""
	EndSelect
	
	If $Name1 <> ""
		$Name2 = TranslateName(3, "", 3, $Name1, 1)
		
		If $Name2[1] = 0
			
			$Found = 0
			While $Found = 0
				$commaloc = InStr($Name2[0], ",")
				If $commaloc > 1
					If SubStr($Name2[0], $commaloc - 1, 1) = "\"
						$Name2[0] = SubStr($Name2[0], $commaloc + 1)
					Else
						$Found = 1
						$CurrentContainer = SubStr($Name2[0], $commaloc + 1)
					EndIf
				Else
					$Found = 1
				EndIf
			Loop
			
			Select
				Case $CurrentContainer = $Container $InContainer = 1, $Name2[1], $Name2[2]
				Case InStr($Name2[0], $Container) $InContainer = 2, $Name2[1], $Name2[2]
				Case 1 $InContainer = 0, $Name2[1], $Name2[2]
			EndSelect
		Else
			$InContainer = -2, $Name2[1], $Name2[2]
		EndIf
	Else
		$InContainer = -1, 0, ""
	EndIf
EndFunction


Edited by Mart (2009-04-08 12:00 PM)
Edit Reason: Typo.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.