#36799 - 2003-02-21 12:58 AM
ingroup @wksta\administrators
|
j95661
Getting the hang of it
Registered: 2001-02-27
Posts: 84
Loc: sacramento,ca usa
|
I'm having a problem determining wether the logging in user is in the local administrators group.
code:
If ingroup("\\" + @Wksta + "\Administrators") = 1 ? "yeah you can break stuff now" else ? "sorry you can't delete all the registry keys today" endif
I have verified on serveral machines that ingroup is returning "0" when they really are a local administrator. I have seen several posts regarding this topic but nothing was ever determined. I can always shell out but I would rather not.. any one have any ideas.. is this a "feature" :-)
code:
Shell "%comspec% /c net localgroup administrators | find /i '@userid'" if @error = 0 do something else do nothing endif
_________________________
WonderBoy
Constantly learning everyday, how much I dont know :-)
|
|
Top
|
|
|
|
#36800 - 2003-02-21 01:14 AM
Re: ingroup @wksta\administrators
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Is this reproducible on your computer? I have not had this issue yet, but would love to investigate an actual occurrence.
If it is, please supply the result of the KiXtart and DOS code in your post.
Include OS and version information. What is the domain architecture and where is this computer in the architecture. [ 21. February 2003, 01:16: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#36802 - 2003-02-21 07:30 AM
Re: ingroup @wksta\administrators
|
j95661
Getting the hang of it
Registered: 2001-02-27
Posts: 84
Loc: sacramento,ca usa
|
Kixtart version 4.02 Workstation is Windows XP NT 4.0 domain structure
I have duplicated this specifically on this machine but my other Windows 2000 desktops don't have this issue. Neither does my desktop which is running Windows XP. I have had problems in the past when creating our loginscript with the ingroup function and have had to revert to shelling out to "net localgroup".
This person has been a local administrator on this machine, so there should not have been any conflicting cached local group membership entries in the registry.
The only error that I am getting is the errorlevel 0 from the If ingroup. I will check the suggested registry key tomorrow. thanks for the help guys. [ 21. February 2003, 07:39: Message edited by: j95661 ]
_________________________
WonderBoy
Constantly learning everyday, how much I dont know :-)
|
|
Top
|
|
|
|
#36805 - 2003-02-21 06:06 PM
Re: ingroup @wksta\administrators
|
j95661
Getting the hang of it
Registered: 2001-02-27
Posts: 84
Loc: sacramento,ca usa
|
thanks NTDOC
yup that works. the suggestion you made
code:
if ingroup("\\" + @Wksta + "\Administrators")<>0 do some stuff endif
has this reliably worked. I am currently using shell for deciding wether the user is a member of several other local groups. I want to use whatever will give me the most acurate results.
thanks
_________________________
WonderBoy
Constantly learning everyday, how much I dont know :-)
|
|
Top
|
|
|
|
#36806 - 2003-02-21 06:12 PM
Re: ingroup @wksta\administrators
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Please run:
? vartypename(ingroup("\\" + @Wksta + "\Administrators"))
it should state Boolean
if this works:code:
if ingroup("\\" + @Wksta + "\Administrators")<>0 do some stuff endif
so should code:
if ingroup("\\" + @Wksta + "\Administrators") do some stuff endif
Does this still fail? code:
if ingroup("\\" + @Wksta + "\Administrators") = 1 do some stuff endif
[ 21. February 2003, 18:12: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#36807 - 2003-02-21 08:16 PM
Re: ingroup @wksta\administrators
|
j95661
Getting the hang of it
Registered: 2001-02-27
Posts: 84
Loc: sacramento,ca usa
|
the machine that is in question is not here today, but I will validate this next week.
Not sure how
code:
If InGroup("\\" + @WKSTA + "\ADMINISTRATORS")<>0 Do some stuff Else
would work if
code:
If InGroup("\\" + @Wksta + "\Administrators") =1 Do some stuff EndIf
doesnt work. But hey I'm willing to give it a shot. [ 21. February 2003, 20:21: Message edited by: j95661 ]
_________________________
WonderBoy
Constantly learning everyday, how much I dont know :-)
|
|
Top
|
|
|
|
#36808 - 2003-02-21 08:25 PM
Re: ingroup @wksta\administrators
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Want I am truly looking to determine is if KiXtart is not properly comparing the Boolean value returned by INGROUP to the interpretation of the '1'.
You stated the that the "<> 0" version worked but based on your original post "= 1" failed on some computers
I am trying to determine the OS/version, versions of KiXtart involved, what vartyprname() ingroup is returning, and does the the "=1" fail where "<> 0" works on each computer.
So if you could compile the results of the requested code above we could see if something fishy is going on. [ 21. February 2003, 20:26: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|