Your post will do exactly that, but reading into the groups and mappings I suspect that this might be closer to what you want:


; Mappings for all staff
MapDrive("G:","\\Server1\Sys\"+@userid)
MapDrive("N:","\\nw-data-store1\"+@userid) ;map share to Users home folder
MapDrive("U:","\\Server1\Vol2")

; Mappings for specific marketing groups.
If InGroup("NW_MKT_PRIVATE") MapDrive("P:","\\nw-data-store1\nw_mkt_private") EndIf
If InGroup("NW_CONS_MKT_PRV") MapDrive("R:","\\nw-data-store1\nw_cons_mkt_prv") EndIf
If InGroup("NW_COMM_MKT_PRV") MapDrive("S:","\\nw-data-store1\nw_comm_mkt_prv") EndIf

; Generic map drive function with error reporting.
Function MapDrive($d,$p)
"Mapping drive "+$d+" to "+$p+"..."
Use $d /delete /persistent
Use $d $p
If @ERROR
" ***ERROR***"+@CRLF
" "+@ERROR+" / "+@SERROR+@CRLF
Else
" Ok."+@CRLF
EndIf
EndFunction