Status Update.
Well, i really didnt get your code up and running, so i made some cuts and pastes and tied stuff together..
I think i have a problem with LDAP

Anyone finding anything wrong with the code below, or improvements, let me know.. Its going into production with 10000 users within a couple of months ...

Bjorn Tore

----------------------------------------------------------

; ======================================================================
;
;
; NAME: ConnectLocationDrive.Kix
;
; AUTHOR: Bjørn Tore Jakobsen
; DATE : 26.03.2004
;
; COMMENT: Basically what this does is find the first group the logged on user is a member of
; that starts with AK-LOC, then reads out the comment(description) field on the group.
; Then it maps the share specified in the comment field.
; If the user is not a member of such a group, it maps to a default share.
;
; ConnectLocationDrive("W:, AK-LOC, ;")
; First parameter = Drive to map to.
; Second parameter = first part of group name to search for
; Third Parameter = Delimiter in the groups comment field.
; NB! The path to the share has to be after the first ";" in the comment field.
; ========================================================================
;
;ConnectLocationDrive("W:, AK-LOC, ;")


Function ConnectLocationDrive( $DriveDefinition )

$DriveLetter=SubStr($DriveDefinition,1,InStr($DriveDefinition,",")-1)
$DriveDefinition=LTrim(RTrim(SubStr($DriveDefinition,InStr($DriveDefinition,",")+1)))
$GroupDescr=LTrim(RTrim(SubStr($DriveDefinition,1,InStr($DriveDefinition,",")-1)))
$DescDelim=LTrim(RTrim(SubStr($DriveDefinition,InStr($DriveDefinition,",")+1)))

$findstr = $GroupDescr
$delim = $DescDelim
$DefaultPath = "\\Server\DATABIN"

Global $NetPath[1]

;**************************
;Get the user's groups
;**************************

$LServer = Substr("@LSERVER",3)

$objUser = GetObject("WinNT://$LServer/@UserID,user")
$found = 0
For Each $group in $objUser.Groups
if InStr($group.name,$findstr)>0 and $found<>1
$found=1
$NetPath = Split($Group.description,$delim)
? "Found"
Use $DriveLetter /delete
;Progress("Connecting " + $DriveLetter + " to " + $NetPath[1])
Use $DriveLetter $NetPath[1]
EndIf
Next
If found = 0
? "not found"
Use $DriveLetter /delete
;Progress("Connecting Default" + $DriveLetter + " - " + $DefaultPath)
Use $DriveLetter $DefaultPath
EndIf

EndFunction