Page 1 of 1 1
Topic Options
#159220 - 2006-03-16 05:00 PM Using If In Group
Bill Offline
Lurker

Registered: 2006-03-16
Posts: 4
Loc: Nebraska
I am trying to figure out how to map a drive based on Group, I have directories from A-Z which represent users groups. I want to do the same as mapping a user to a drive but with a group. If In Group (GroupID) \\server1\groupID which would map based on groupid vice userid. Case InGroup("TNT\AG")
If InGroup("TNT\AG") < However I want the AG to be something like @GroupId so that it will map AG to the AG dir on my file server.
Use R: $server1 + "AG" /persistent
Any help that can be provided would be GREATLY appreciated.
_________________________
Bill K. "I have not failed. I’ve just found 10,000 ways that don’t work."

Top
#159221 - 2006-03-16 05:56 PM Re: Using If In Group
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
then cast it to a string var and use it in the condition.
$Whatever = 'bla'
$Group = 'TNT\' + $Whatever
If InGroup($Group)
Use R: $Server1 + $Whatever
EndIf

BTW, it makes no sense to map persistent if it is mapped on every logon.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#159222 - 2006-03-16 08:14 PM Re: Using If In Group
Bill Offline
Lurker

Registered: 2006-03-16
Posts: 4
Loc: Nebraska
Thanks for making me feel like an idiot over such an easy fix. You are the man. And I have removed the persistent from there. Thanks.
_________________________
Bill K. "I have not failed. I’ve just found 10,000 ways that don’t work."

Top
#159223 - 2006-03-16 08:39 PM Re: Using If In Group
Bill Offline
Lurker

Registered: 2006-03-16
Posts: 4
Loc: Nebraska
Ok I am still a little confused, if I want a specific group to map to a directory I have multiple groups AA, AB, AC to map to AA, AB, AC directories on a file sever, below you have set to where I have to have seperate entries for each group, is that the case?

I want to map multiple groups to different Dir's with a single variable.
_________________________
Bill K. "I have not failed. I’ve just found 10,000 ways that don’t work."

Top
#159224 - 2006-03-16 09:11 PM Re: Using If In Group
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
How many group/directories do you have?

we can work on optimizing the code once you get something working. At this point you can repeat the code Les gave you. Change $Whatever to the group name in each case.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#159225 - 2006-03-16 09:17 PM Re: Using If In Group
Bill Offline
Lurker

Registered: 2006-03-16
Posts: 4
Loc: Nebraska
I have 82 groups. That would be troublesome to put that entire lot in a Kix script. Each on of those groups is asscoiated to a Directory on my file server. Group AA Dir AA, Group BB Dir BB and so on.
_________________________
Bill K. "I have not failed. I’ve just found 10,000 ways that don’t work."

Top
#159226 - 2006-03-16 09:44 PM Re: Using If In Group
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I would then use the UDF DirPlus or something similar to get an array of directories. then...
untested
Code:

$UNC = "\\server\share"
$dirArray = dirplus($UNC,"/ad")

for each $dir in $DirArray
$Group = 'TNT\' + $dir
If InGroup($Group)
Use R: $Server1 + $dir
EndIf
next



Actually I would use one of the MapDrive UDF for the actual mapping.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#159227 - 2006-03-16 09:45 PM Re: Using If In Group
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Well sorry, but I see no way around it.
Also, there are only drives up to Z unless you do drive mounting.

How to create and use NTFS mounted drives in Windows XP
http://support.microsoft.com/kb/307889
 
You could use a .ini file to do the read group stuff but not much different than having it in the code

If InGroup('MyDomain\AA)
  USE USE E: "\\SERVER\AA"
EndIf
 
If InGroup('MyDomain\BB)
  USE USE E: "\\SERVER\BB"
EndIf
 

and so on and so on.

If you don't want to do it in script then at the machine map it as a persistent drive and don't deal with it in the script. The OS will map it each time it logs on for that user.
 

Top
#159228 - 2006-03-16 09:46 PM Re: Using If In Group
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Well Howard's idea is maybe cleaner, but you're still 'dealing with it' in the script.
Top
#159229 - 2006-03-16 09:47 PM Re: Using If In Group
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Actually you may want to
Code:

for $x=0 to ubound($DirArray)
$Group = 'TNT\' + $dir
If InGroup($Group)
MapDrive ...
$x=ubound($DirArray)+1
EndIf
next



This would keep the rest of the group checks from taking place once a match is found.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1188 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.06 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org