Interesting concept for resource mapping, but I'll tell you it won't scale well, especially if you're defining the array in your script.

Here's a couple of ideas:

The example below extracts the printer ID immediately, then converts the array to a temporary delimited string ("~printer~user~user2~"). Then a simple InStr() function is used to check for the USERID being present in the temp string. By wrapping the USERID in the same delimiters, you can avoid situations where a partial match might occur ("Jon" matches "Jon" and "Jonathan").

 Code:
Break On

Dim $IPrinters[1]

$USERID = 'Barney'   ; simulate content of @USERID

; Printer mappings - printer followed by list of users - only 1 for test
$IPrinters[0] = 'Prnt05', 'Fred', 'Barney', 'Wilma', 'Betty'
$IPrinters[1] = 'Prnt06', 'George', 'Jane', 'Elroy', 'Judy'

; Enumerate the mapping table
For Each $Row in $IPrinters
  ; Get the printer from element 0
  $MyPrinter = $Row[0]
  ; convert to temp string with "~" delimiters, including start and end of string
  $Tmp = '~' + Join($Row, '~') + '~'
  ' Is a delimited version of the user ID found in the temp string? 
  If InStr($Tmp, '~' + $USERID + '~')
    'Map printer ' $MyPrinter ' for ' $USERID ?
  EndIf
Next


A much more sustainable method would be to user an INI file, something like this:
 Code:
[PRINTERS]
;List printers - the value is unimportant, as it simply allows defining a list to enumerate
Prnt01=1
Prnt02=1
Prnt03=1

; list the parameters related to each printer
; UNC is the unc path, which allows simpler names for administration
; Users is a comma-delimited list of individual user accounts used to map the printer
; Groups is a comma-delimited list of AD Groups used to map the printer
[PRNT01]
UNC=\\server\printer
Users=User1,User2,User3

[PRNT02]
UNC=\\server\printer
Users=User1,User3,User5
Groups=PR-Prnt02

[PRNT03]
UNC=\\server\printer
Users=User2,User4,User6
and here's some logic to manage this:
 Code:
Break On

$USERID = 'User3'

; Get the list of printers to be mapped
$aPrinters = Split(ReadProfileString('.\Prnt.ini', 'PRINTERS', ''), Chr(10))

; Enumerate the list of printers and check for user or group-based mapping
; Set MapIt flag if either match is found
For Each $Printer in $aPrinters

  If $Printer  ; a non-blank value? 
    $MapIt = 0  ; don't map, by default

    'DEBUG: processing ' $Printer ?	; debugging

    ; Tmp contains comma-delimited list of users, including delims at start/end of string
    $Tmp = ',' + ReadProfileString('.\Prnt.ini', $Printer, 'Users') + ','

    ; if we match the current user id, map the printer. Note the delimiter is now ","!
    If InStr($Tmp, ',' + $USERID + ',')
      $MapIt = 1  ; Ok to map this printer
    EndIf

    ; Check for AD Group based mapping
    $Tmp = ReadProfileString('.\Prnt.ini', $Printer, 'Groups')
    If InGroup($Tmp, $USERID)
      $MapIt = 1
    EndIf

    ; If MapIt is true, perform the printer mapping and log / display the action
    If $MapIt
      $PrtUnc = ReadProfileString('.\Prnt.ini', $Printer, 'UNC')
      'Maping printer ' $Printer ' (' $PrtUnc ') for ' $USERID ?
      ; the printer mapping logic goes here...
      ; AddPrinterConnection($PrtUnc)
      ; @SERROR ?  ; show result
      ; add error-handling logic...
    EndIf

  EndIf
Next
This will be much more flexible, eliminate issues from needing to change the code every time a mapping changes.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D