#47175 - 2003-10-22 08:17 PM
Use of InGroup
|
Scott A. Chase
Fresh Scripter
Registered: 2003-10-22
Posts: 5
|
I am testing something out that I want to use in my standard logon script. I have a script I have been using for years that works fine basically detecting a user's global group memberships and mapping drives accordingly. I do this using "InGroup." I also check to see if a user is in more than one group and map differently as necessary. I use 95/98/NT/W2k/XP workstations and NT4 servers and have generally had no problems.
However, I have encountered a situation where I have had to use "InGroup32" or "InGrp." I don't know why and I can find no documentation on this. For example, the following:
SELECT CASE InGroup(MIS) AND @WUserID = "sys-sc" USE X: "\\POR-NT1\SCANS$" ENDSELECT
works only if I use "InGroup32" or "InGrp." Can anyone explain this to me? Scott
|
Top
|
|
|
|
#47176 - 2003-10-22 08:24 PM
Re: Use of InGroup
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
I would suggest trying the more standard syntax using quoted strings in the InGroup and doubling-up your dollar-sign ...
code:
SELECT CASE InGroup("MIS") AND @WUserID = "sys-sc" USE X: "\\POR-NT1\SCANS$$" CASE 1 ENDSELECT
-Shawn
|
Top
|
|
|
|
#47180 - 2003-10-22 08:39 PM
Re: Use of InGroup
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
InGrp is in the Google Groups and has a VB Reference.
Kent
|
Top
|
|
|
|
#47181 - 2003-10-22 08:41 PM
Re: Use of InGroup
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Why are you doing the following?
code:
SELECT CASE InGroup(MIS) AND @WUserID = "sys-sc" USE X: "\\POR-NT1\SCANS$" ENDSELECT
You should get the desired effect with:
code:
IF InGroup("MIS") AND @WUserID = "sys-sc" USE X: "\\POR-NT1\SCANS$" ENDIF
HTH,
Kent
|
Top
|
|
|
|
#47182 - 2003-10-22 08:43 PM
Re: Use of InGroup
|
Scott A. Chase
Fresh Scripter
Registered: 2003-10-22
Posts: 5
|
Thanks for you prompt replies. I have not added this code to my production script so the snippet I entered here is running standalone from the command line using kix32. As to explaining "ingroup32" and/or "ingrp," I can't. That is why I asked if anyone has any insight. Somewhere once, I found that I could make "ingroup32" work when "ingroup" did not. Once I accidently typed in "ingrp" and found that also worked where "ingroup" did not.
I tried running this using Shawn's suggestions and the mapping still does not occur. Back to the drawing board. Scott
|
Top
|
|
|
|
#47183 - 2003-10-22 08:47 PM
Re: Use of InGroup
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
OK..
Try this - code:
IF InGroup("MIS") AND @UserID = "sys-sc" USE X: "\\POR-NT1\SCANS$$" ENDIF
If this does not work, try this if you have multiple domains.. code:
IF InGroup("DOMAIN\MIS") AND @UserID = "sys-sc" USE X: "\\POR-NT1\SCANS$$" ENDIF
You may have to add some debugging code..
Kent [ 22. October 2003, 20:48: Message edited by: kdyer ]
|
Top
|
|
|
|
#47185 - 2003-10-22 09:12 PM
Re: Use of InGroup
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
I think Jens hit the nail on the head ... depending on the version of kix32, your InGroup32(xxx) and InGrp(xxx) are probably being treated as simply strings which are always true.
By the way, which version of Kixtart you running ?
I would definitely go back to the proper syntax, then debug the real problem. Using Kent's code, put in some tracers like this:
code:
IF InGroup("MIS") AND @WUserID = "sys-sc" ?"In da group..." USE X: "\\POR-NT1\SCANS$$" ?"ERROR @ERROR : @SERROR" ENDIF
[ 22. October 2003, 21:13: Message edited by: Shawn ]
|
Top
|
|
|
|
#47186 - 2003-10-22 09:27 PM
Re: Use of InGroup
|
Scott A. Chase
Fresh Scripter
Registered: 2003-10-22
Posts: 5
|
Kent, I tried your suggestions to no avail. Jens, as I said, I don't know the source of "ingroup32" or "ingrp" but have found that "ingrp32" works also. I ran kixstrip against the script and it found no errors. My logon process still uses an older version of kixtart that included "unlock," "ingrp32," "setw," and "unstick." I copied the 4.21 files to my net logon directory to demo it and came across this situation.
Nonetheless I have remedied my problem. Operator malfunction. Interestingly enough, the three unknown group functions either just did not work and mapped the drive anyhow or they ignored the group requirement and acted on the userid requirement.
Thanks for your time. Scott
|
Top
|
|
|
|
#47189 - 2003-10-22 09:58 PM
Re: Use of InGroup
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Now this is wierd..
Created a test script and it does not error out with ingrp32, InGrp, and Ingroup..
Here is the script -
code:
cls break on
?@kix
If ingroup("Domain Users") ?"ingroup test for Domain Users - works" ?"ERROR @ERROR : @SERROR" ELSE ?"ingroup test for Domain Users - does not work" ?"ERROR @ERROR : @SERROR" ENDIF
If ingrp32("Domain Users") ?"ingrp32 test for Domain Users - works" ?"ERROR @ERROR : @SERROR" ELSE ?"ingrp32 test for Domain Users - does not work" ?"ERROR @ERROR : @SERROR" ENDIF
If InGrp("Domain Users") ?"InGrp test for Domain Users - works" ?"ERROR @ERROR : @SERROR" ELSE ?"InGrp test for Domain Users - does not work" ?"ERROR @ERROR : @SERROR" ENDIF
If InTest("Domain Users") ?"InTest test for Domain Users - works" ?"ERROR @ERROR : @SERROR" ELSE ?"InTest test for Domain Users - does not work" ?"ERROR @ERROR : @SERROR" ENDIF
get $k
And the results: quote:
4.21 ingroup test for Domain Users - works ERROR 0 : The operation completed successfully.Domain Users ingrp32 test for Domain Users - works ERROR 0 : The operation completed successfully.Domain Users InGrp test for Domain Users - works ERROR 0 : The operation completed successfully.Domain Users InTest test for Domain Users - works ERROR 0 : The operation completed successfully.
Kent
|
Top
|
|
|
|
#47192 - 2003-10-22 10:09 PM
Re: Use of InGroup
|
Scott A. Chase
Fresh Scripter
Registered: 2003-10-22
Posts: 5
|
I am not sure what version of Kixtart (the executable is from late 1997) that was and I believe those operators, though they came with the program, were 3d party. They were not functions.
BTW, that was my whole script. I am testing some functionality prior to inserting a new section in my script.
As to the other "in group" macros/functions, I think they just don't plain work or are not recognized. I realized that I had a real short script running on another domain that was mapping the drive no matter what group you were in. It never errored out. However, when I switched it back to "ingroup," I could not get it to map without using kix32 even though it was doing nothing different than my logon script in another domain using kixtart.
Scott
|
Top
|
|
|
|
#47193 - 2003-10-22 10:15 PM
Re: Use of InGroup
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Gotta love Kix !!! Its just like the KF shortcuts we (ok, some) use for boolean ...
$Form.Visible = True
We can rely on good olde Kixtart to convert most mal-formed code in simple strings, that always evaluate true (except for "0" and NOT "0" but thats another story)
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 323 anonymous users online.
|
|
|