Page 1 of 1 1
Topic Options
#118997 - 2004-05-04 07:23 PM Ingroup
caswell Offline
Lurker

Registered: 2001-11-16
Posts: 4
Does the Ingroup function work with local groups? I'd like to check for membership in the local administrators group before trying to apply patches, etc. I've tried the following with inconsistent results (in a script launched with the /f switch):

If InGroup("\\" + @WKSTA + "\administrators") <> 1
MESSAGEBOX ("Your Logon does not have permissions to perform a vital update!!", "Contact Technical Support Services 6627!", 48)
goto "endit"
endif

Top
#118998 - 2004-05-04 07:40 PM Re: Ingroup
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
See When admin is not admin? and more specifically, this code.
Code:
Break on
? "Priv : " + @priv
? "Admin Group: "
if ingroup("\\" + @wksta + "\administrators")
"True"
else
"False"
endif
? "Local Admin: "
if localadmin()
"True"
else
"False"
endif


function LocalAdmin()
$LocalAdmin=ingroup('@wksta\'+sidtoname('S-1-5-32-544'))-1+@inwin
endfunction

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#118999 - 2004-05-04 07:43 PM Re: Ingroup
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
Check out this post... When Admin is not Admin?

I was doing some testing back then, and there is a script in the top post that checks for local admin three different ways.

[edit
dang... Les you just beat me!]


Edited by Al_Po (2004-05-04 07:44 PM)

Top
#119000 - 2004-05-04 07:46 PM Re: Ingroup
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You mean like the one I posted?

Beat you by three whole minutes!


Edited by Les (2004-05-04 07:46 PM)
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#119001 - 2004-05-04 07:51 PM Re: Ingroup
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
You must have been posting your response as I was typing and looking up mine. Well at least we were consistant on a possible solution.
Top
#119002 - 2004-05-04 07:56 PM Re: Ingroup
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well.. I went with your answer so you are the true winner here. Still, one must wonder why the original code does not work. Is it a localization issue, or KiX 3.xx returning a 2?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

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
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.055 seconds in which 0.014 seconds were spent on a total of 13 queries. Zlib compression enabled.

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