Page 1 of 1 1
Topic Options
#36799 - 2003-02-21 12:58 AM ingroup @wksta\administrators
j95661 Offline
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 Offline
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 ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#36801 - 2003-02-21 06:40 AM Re: ingroup @wksta\administrators
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Hey...

You can try checking the..

HKCU\Software\KiXtart\TokenCache

key to see if the local admin is actually listed as one of the users groups.

Top
#36802 - 2003-02-21 07:30 AM Re: ingroup @wksta\administrators
j95661 Offline
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
#36803 - 2003-02-21 07:48 AM Re: ingroup @wksta\administrators
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Hello Jason,

Please try the following code.



IF INGROUP("\\@WKSTA\Administrators")
 ? "You are a Local Administrator"
ELSE
 ? "You are NOT a Local Administrator"
ENDIF



Let us know if it DOES not work. I have it working on about 1,200+ NT/2000/XP workstations and Servers.

Your code DOES work for me as well, but perhaps the part where you are specifying the 1 is confusing this machine for some reason.

You could also try <>0

[ 21. February 2003, 07:50: Message edited by: NTDOC ]

Top
#36804 - 2003-02-21 02:51 PM Re: ingroup @wksta\administrators
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Try deleting the token cache out of the reg. Doing stuff like computer renames can mess it up.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#36805 - 2003-02-21 06:06 PM Re: ingroup @wksta\administrators
j95661 Offline
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 Offline
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 ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#36807 - 2003-02-21 08:16 PM Re: ingroup @wksta\administrators
j95661 Offline
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 Offline
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 ]
_________________________
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 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.069 seconds in which 0.033 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