#176309 - 2007-05-16 03:12 PM
Re: using an array to map drives based on group membership
[Re: Pieman]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Hi Pieman, I am sure there are plenty of people that can help you out, if you post what you have for InGroup() stuff we can better help you.
|
Top
|
|
|
|
#176311 - 2007-05-16 03:33 PM
Re: using an array to map drives based on group membership
[Re: Benny69]
|
Pieman
Fresh Scripter
Registered: 2002-08-20
Posts: 29
|
OK, Here is a small snipet of the ingroup statements, there are aleast 20+ group and probably just as many shares so as you can imagine the code gets quite long and repetative... remember I am an ejit with this so don't laugh at the code at the moment it does the job...
Select
Case InGroup("finance_gbl")
Use F: "\\server_name\share"
If @ERROR
$message = MessageBox('Error: '+@ERROR+'-'+@SERROR, 'Error Mapping Finance drive',48)
EndIf
Case InGroup("finance ro_gbl")
Use F: "\\server_name\share"
If @ERROR
$message = MessageBox('Error: '+@ERROR+'-'+@SERROR, 'Error Mapping Finance drive',48)
EndIf
EndSelect
Select
Case InGroup("Design_gbl")
Use G: "\\server_name\share"
If @ERROR
$message = MessageBox('Error: '+@ERROR+'-'+@SERROR, 'Error Mapping Design drive',48)
EndIf
Case InGroup("Design ro_gbl")
Use G: "\\server_name\share"
If @ERROR
$message = MessageBox('Error: '+@ERROR+'-'+@SERROR, 'Error Mapping Design drive',48)
EndIf
Case InGroup("TCADRD_gbl")
Use G: "\\server_name\share"
If @ERROR
$message = MessageBox('Error: '+@ERROR+'-'+@SERROR, 'Error Mapping Design drive',48)
EndIf
EndSelect
_________________________
It takes a human hours to fcuk up what a computer can do in seconds...
|
Top
|
|
|
|
#176313 - 2007-05-16 03:55 PM
Re: using an array to map drives based on group membership
[Re: Pieman]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
give this a spin;
$Groups = "finance_gbl","finance ro_gbl"
$Drive = F:
$Shares = "\\server_name\share","\\server_name\share"
CheckGroups($Groups,$Drive,$Shares)
$Groups = "Design_gbl","Design ro_gbl","TCADRD_gbl"
$Drive = G:
$Shares = "\\server_name\share","\\server_name\share","\\server_name\share"
CheckGroups($Groups,$Drive,$Shares)
Function CheckGroups($Groups,$Drive,$Shares)
$Index = 0
For Each $Group in $Groups
If InGroup($Group)
Use $Drive $Share[$Index]
If @ERROR
$Msg = MessageBox('Error: '+@ERROR+'-'+@SERROR, 'Error Mapping '+$Drive+' '+$Share[$Index]+' in '+$Group,48)
EndIf
EndIf
$Index = $Index+1
Next
EndFunction
Edited by Benny69 (2007-05-16 04:02 PM)
|
Top
|
|
|
|
#176314 - 2007-05-16 03:58 PM
Re: using an array to map drives based on group membership
[Re: Benny69]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
I just modified the code i just posted, thought it needed trimmed down a little.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 507 anonymous users online.
|
|
|