Don't think I posted this (yet)- this could also work - right from the example in the header.

Glenn


;; 
;;====================================================================== 
;; 
;;FUNCTION       GetUserOU() 
;; 
;;ACTION         Returns the OU string for the current user 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION	 1.0 - 2006/12/06 
;; 
;;SYNTAX         GetUserOU(Object) 
;; 
;;PARAMETERS     Object - OPTIONAL - Specify a particular object ID to return 
;; 
;;REMARKS        Initial development for use in the Universal Login Script 
;; 
;;RETURNS        String - comma-delimited OU list - OU=x,OU=y,DC=dom,DC=local 
;;               or, with Object specified, the specific object without the qualifier 
;;               eg: GetUserOU(1) returns "y" instead of "OU=x,OU=y,DC=dom,DC=local" 
;; 
;;DEPENDENCIES   none 
;; 
;;TESTED WITH    W2K, WXP, W2K3 
;; 
;;EXAMPLES       If GetUserOU(1) = "My Dept OU"  
;;                 Use E: \\server\share 
;;               EndIF 
; 
Function GetUserOU(OPTIONAL $_Object)
 
  Dim $_aTemp, $_Work, $_ADSys, $_First, $_I, $_D
 
  $_D = ''
 
  $_ADSys = CreateObject('ADSystemInfo')
  If @ERROR Exit @ERROR EndIf			; exit if error creating object 
  $_aTemp = $_ADSys.UserName
  If @ERROR Exit @ERROR EndIf			; exit if error obtaining data 
 
  ; Handle a "Last, First" situation 
  $_I = InStr($_aTemp, '\,')
  If $_I
    $_aTemp = Left($_aTemp, $_I - 1) + SubStr($_aTemp, $_I + 2)
  EndIf
 
  ; Remove the CN= portion 
  If InStr($_aTemp, 'CN=')
    $_aTemp = SubStr($_aTemp, InStr($_aTemp, ',') + 1)
  EndIf
 
  ; Split the remaining OU and DC components into an array 
  $_aTemp = Split($_aTemp, ',')
 
  ; Return only OU and DC info - build the string 
  For Each $_I in $_aTemp
    If Not InStr($_I, 'CN=')
      $_Work = $_Work + $_D + $_I
      $_D = ','
    EndIf
  Next
 
  ; return the string, or the specific object requested 
  $GetUserOU = IIf($_Object, SubStr(Split($_Work, ',')[$_Object], 4), $_Work)
 
  Exit 0
 
EndFunction
 
 
 
_________________________
Actually I am a Rocket Scientist! \:D