Hi
I found this GREAT kix code which use group.ini file to connect drives to specified groups members.
Unfortunately it wonīt detect "sub group members" when some AD group belongs to other group and
this other group has members.
Also I couldnīt find correct way to solve problems if share name contain $ or - marks in it name.
(like \\server\backup$ or \\server\pdf-documents) Whole script will terminate to error.
Gurus.. please send some advice to correct this script =)
Code:
$logonserver = "Server1"
? "Connecting network drives by your group membership..."
? ""
$sGroupINI = "\\$logonserver\netlogon\kix422\groups.ini"
For Each $group in Split(ReadProfileString($sGroupINI,'',''),Chr(10))
If $group AND InGroup($group)
For Each $drive In Split(ReadProfileString($sGroupINI,$group,''),Chr(10))
If $drive
$resource=readprofilestring($sGroupINI,$group,$drive)
$rc=execute('$$resource='+$resource)
Use $drive+':' /delete /persistent
"Mapping drive "+$drive+": to "+$resource
Use $drive+':' $resource
IF @ERROR <> 0
$FAILDESCRIPTION = "@error / @serror: Letter $drive to $resource"
$FAILNAME = "Connect drives by groups.ini failed"
CALL "\\$logonserver\netlogon\kix422\error_debug_hidden.kix"
COLOR R+/N
" ***ERROR***"
? "["+@ERROR+"] "+@SERROR ?
COLOR W/N
Else
" OK" ?
EndIf
EndIf
Next
EndIf
Next
Group.ini file looks like this..
Code:
[Domain Users]
V= \\server1\share1
X= \\server2\share2
[Quality Users]
T= \\server3\share1
R= \\server4\share2
Regards,
Henry