#123124 - 2004-07-16 04:22 PM
user is member of more then one group
|
Prs01blu
Fresh Scripter
Registered: 2004-04-02
Posts: 15
Loc: Kitchener, ON
|
I'm looking to map users who belongs to more then one group. Server is 2K and the stations are XP PRO. In a SELECT statement, only the first true condition will be processed. The flow of the script will then jump to the ENDSELECT statement, and continue. So I used IF INGROUP to search for user's membership and map the drives accordly. Again is mapping the first group of the array or none..any advice and /or good documentation $Array = "mech", "mech_USR", "super", "test" If InGroup ($Array, 1) = 1 ; Use $Drive /Delete /Persistent Use H: /DELETE Use H:"\\anyserver\DATA\HOME\@USERID" /PERSISTENT $LABELSTATUS.TEXT = "Mapping H: Drive..." $PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 1 Sleep 2 Use K: /DELETE Use K: "\\anyserver\mech" /PERSISTENT $LABELSTATUS.TEXT = "Mapping K: Drive..." $PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 0.5 Sleep 2 Use T: /DELETE Use T: "\\anyserver\DATA\TEMP" /PERSISTENT $LABELSTATUS.TEXT = "Mapping T: Drive..." $PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 0.5 Sleep 2 Use W: /DELETE Use W: "\\anyserver\DATA\TEMPLATE" /PERSISTENT $LABELSTATUS.TEXT = "Mapping W: Drive..." $PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 0.5 Sleep 2 EndIf If InGroup("mech_USR") = 1 Use LPT2: "\\anyserver\mech_LASER" /PERSISTENT If AddPrinterConnection ("\\anyserver\mech_LASER") = 0 SetDefaultPrinter ("\\anyserver\mech_LASER") $LABELSTATUS.TEXT = "Mech_laser default on LPT2 ..." EndIf
If InGroup("super") = 1 Use R: "\\anyserver\DATA\ACCNT\super" /PERSISTENT $LABELSTATUS.TEXT = "Mapping R: Drive..." $PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 1 Sleep 2 Use LPT3: "\\anyserver\super" /PERSISTENT EndIf
If InGroup("test")=1 Use P: "\\anyserver\DATA\ACCNT\test" /PERSISTENT $LABELSTATUS.TEXT = "Mapping P: Drive..." $PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 1 Sleep 2 EndIf thanks in advance for your time .
|
Top
|
|
|
|
#123126 - 2004-07-16 04:49 PM
Re: user is member of more then one group
|
Prs01blu
Fresh Scripter
Registered: 2004-04-02
Posts: 15
Loc: Kitchener, ON
|
I see your point, but not all the users are members of all this groups..so, how can I write the script to map the drive letters, lets say..user X belongs to mech_usr, super, test and user Y belongs to mech and test. The mapping is done just for the first group in the script. The array thing is on the KiXtart manual
|
Top
|
|
|
|
#123128 - 2004-07-16 06:40 PM
Re: user is member of more then one group
|
Prs01blu
Fresh Scripter
Registered: 2004-04-02
Posts: 15
Loc: Kitchener, ON
|
ok, correct me if I'm wrong. 1 Ingroup checks for membership of ALL of the groups in the list. Isn't that what I want to accomplish? ..to check to see in all this groups if the user is member or not and to map the drive and the printer depends of the group. When I run the script it maps just the first group in the list and skips the rest, works fine if the user is member of one group
|
Top
|
|
|
|
#123130 - 2004-07-29 11:53 PM
Re: user is member of more then one group
|
Prs01blu
Fresh Scripter
Registered: 2004-04-02
Posts: 15
Loc: Kitchener, ON
|
ok ..I'm still having problems with mapping and INGROUP. mapping isnt done at all or is running fine for the first INGROUP group. If the "mech" group is in the first group the mapping is done just for them ..If I move "test" group in the first line of script just "tes"t group is mapped. If a user belongs to the both groups ,sometimes not mapping at all and sometimes just for one of the groups..any clues? ..
|
Top
|
|
|
|
#123131 - 2004-07-29 11:59 PM
Re: user is member of more then one group
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Sounds like a program flow problem. Please post your code using the "CODE" tags. We can then see if the code is properly structured.
|
Top
|
|
|
|
#123132 - 2004-07-30 12:15 AM
Re: user is member of more then one group
|
Prs01blu
Fresh Scripter
Registered: 2004-04-02
Posts: 15
Loc: Kitchener, ON
|
ok here is the part of the script starting with the network function
code starts here:
Code:
If InGroup ("mech") = 1
;Use $Drive /Delete /Persistent
Use H: /DELETE
Use H:"\\anyserver\DATA\HOME\@USERID" /PERSISTENT
$LABELSTATUS.TEXT = "Mapping H: Drive..."
$PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 1
Sleep 2
Use K: /DELETE
Use K: "\\anyserver\mech" /PERSISTENT
$LABELSTATUS.TEXT = "Mapping K: Drive..."
$PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 0.5
Sleep 2
Use T: /DELETE
Use T: "\\anyserver\DATA\TEMP" /PERSISTENT
$LABELSTATUS.TEXT = "Mapping T: Drive..."
$PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 0.5
Sleep 2
Use W: /DELETE
Use W: "\\anyserver\DATA\TEMPLATE" /PERSISTENT
$LABELSTATUS.TEXT = "Mapping W: Drive..."
$PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 0.5
Sleep 2
EndIf
If InGroup("mech_USR") = 1
Use LPT2: "\\anyserver\mech_LASER" /PERSISTENT
If AddPrinterConnection ("\\anyserver\mech_LASER") = 0
SetDefaultPrinter ("\\anyserver\mech_LASER")
$LABELSTATUS.TEXT = "Mech_laser default on LPT2 ..."
EndIf
If InGroup("super") = 1
Use R: "\\anyserver\DATA\ACCNT\super" /PERSISTENT
$LABELSTATUS.TEXT = "Mapping R: Drive..."
$PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 1
Sleep 2
Use LPT3: "\\anyserver\super" /PERSISTENT
EndIf
If InGroup("test")=1
Use P: "\\anyserver\DATA\ACCNT\test" /PERSISTENT
$LABELSTATUS.TEXT = "Mapping P: Drive..."
$PROGRESSSTATUS.VALUE = $PROGRESSSTATUS.VALUE + 1
Sleep 2
EndIf
END of Code
..I have a variety of group membership ..some users belongs just to "super" or "super" and "testers" or "testers" and "mech_usr" or just "mech_usr".. Mapping never worked for any users
Added CODE tags - H. Bullock
Edited by Prs01blu (2004-07-30 12:50 AM)
|
Top
|
|
|
|
#123133 - 2004-07-30 12:23 AM
Re: user is member of more then one group
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
It is good programming practice to properly indent your code so that is is easier to read and debug. Please properly format your code. I have added the proper code tags. You can edit your post and replace the code when formatted.
|
Top
|
|
|
|
#123135 - 2004-07-30 02:59 AM
Re: user is member of more then one group
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Are these global or local groups? Have you tried using the domain or server name before the group name? Reviewing your code now.
Edited by Howard Bullock (2004-07-30 03:02 AM)
|
Top
|
|
|
|
#123137 - 2004-07-30 03:08 AM
Re: user is member of more then one group
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I do not see anything malformed with this code you posted. I would suggest that you include "ELSE" statements with logging to verify if the ingroup actually executes or not. There may be a logic error or missing quote elsewhere in the program that somehow affects this block.
|
Top
|
|
|
|
#123138 - 2004-07-30 03:10 AM
Re: user is member of more then one group
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I was looking at that too, but failed to comment. I agree that the /PERSISTENT switch should be removed from the "USE" statement but should be permanently added to the "USE /DELETE" in case a user remaps a drive to another location.
|
Top
|
|
|
|
#123140 - 2004-07-30 03:04 PM
Re: user is member of more then one group
|
Prs01blu
Fresh Scripter
Registered: 2004-04-02
Posts: 15
Loc: Kitchener, ON
|
OOOPPSS!!.. I brush up my script one more time and yes, always-small details count a lot…editing the post and properly indent the script code.
To respond to everyone:
1.-yes I agree with /delete and /persistent and I'll make the changes right away.
2.-the entire logon script was running ok, but mapping was always skipped and logon was completed with no error messages. They are successfully logged on to domain and if you try to map the drives, mapping is successfully done.
3.-my progress bar function is part of the script and basically gives you an idea of how the logon script progress until is done.
OK. So I realized that I had in my script a line here is the code:
Code:
If InGroup("mech_USR") = 1
Use LPT2: "\\anyserver\mech_LASER" /PERSISTENT
If AddPrinterConnection ("\\anyserver\mech_LASER") = 0
SetDefaultPrinter ("\\anyserver\mech_LASER")
$LABELSTATUS.TEXT = "Mech_laser default on LPT2 ..."
EndIf
IF Addprinterconection () with no ENDIF . I made the changes and now the mapping it is working fine .
I posted so many details just in case somebody has the same or similar problem..
Thanks Howard, Sealeopard, and Les for you help and advice. No so confused any more!
Edited by Prs01blu (2004-07-30 03:06 PM)
|
Top
|
|
|
|
#123141 - 2004-07-30 09:21 PM
Re: user is member of more then one group
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Sorry, dude. I looked over you posted code and missed the missing ENDIF also. It is plain as day just above.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 259 anonymous users online.
|
|
|