Something like this:
 Code:
[Drive G]
PATH=\\server\folder
NAME=The cool kids share
DISK=G:
GROUPS=group1,group2
Repeat as needed.

Then, simple ReadProfileString() functions are all you need.
 Code:
; Get a list of drive mappings from the INI file
$aMappings = Splic(ReadProfileString('config.ini', '', ''), Chr(10))
For Each $Map in $aMappings
  $Path = ReadProfileString('config.ini', $Map, 'PATH')
  $DISK = ReadProfileString('config.ini', $Map, 'DISK')
  ; Get list of groups
  $Grps = ReadProfileString('config.ini', $Map, 'GROUPS')
  $OK = 1        ; OK to map this resource
  If $Grps       ; if Grps is defined, check for membership
    If Not InGroup($Grps)
      $OK = 0    ; not a member, so NOT OK
    EndIf
  EndIf
  If $OK         ; OK to map resource
    USE $Disk $Path
  EndIf
Next
This is somewhat oversimplified - could use error checking, logging, user messages, etc, but this is the basic premise of using external data. Using a more advanced drive mapping UDF will allow you to use the NAME parameter as the mapped drive description, which is why I added it. These UDFs provide much more control and enhanced features compared to the Use command.

There are UDFs available that will read the INI and return a list of sections, but that's basically what the first step does - the list of drive mappings can then be enumerated easily and each processed one at a time.

You should never worry about the size of a UDF - it does the job and you should never modify it - just add it to your code. I write simple scripts with just 10-15 lines of actual logic, then KGen identifies and includes all the UDFs that I used and the script becomes 1000+ lines - so what? I never look at the UDFs once they are written and placed into a script.

As for "@DOMAIN", that will reference your DC, not a file server. Putting shares on a DC is a significant security risk. DCs should be small systems that provide security and DNS services ONLY. We don't install any apps (like Acrobat, Zip/rar, net scan), services (no DHCP even!), or other non-security roles. IAS/RADIUS is one of the only features we might add to a DC. When we bring on a new client, we clean up the DC to meet security standards, as more and more companies are being audited by their customers to identify and mitigate risk of data breach. A dedicated file and app server and a few hours of consulting time is much less expensive than losing a client or dealing with a data breach.

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