First thing you will need is that latest version of Kixtart (4.22), then just create your function somewhere in your script, like this:

Code:

FUNCTION MapDrive($Group, $Drive, $Share)
IF INGROUP($Group)
IF EXIST($Drive)
USE $Drive /DELETE
ENDIF
USE $Drive $Share
IF @ERROR
? "Error mapping drive $Drive to $Share. "+@SERROR
ENDIF
ENDIF
ENDFUNCTION



Then, just call your custom function from elsewhere in your script (like from your "mainline") ... like this:

MapDrive("Domain Users", "M:", "\\SERVER\SHARE")

-Shawn