Page 1 of 1 1
Topic Options
#119479 - 2004-05-13 01:20 PM Check if admn rights
cellnet Offline
Starting to like KiXtart

Registered: 2002-02-26
Posts: 115
Loc: Sweden
hello

did a search but found nothing.

I need to check if a user has local admin rights.

The problem is that the user account is NOT added to local admin group.

Need to check what the user rights are

Regards
\erik

Top
#119480 - 2004-05-13 01:31 PM Re: Check if admn rights
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
This should do...

Code:

If InGroup("\\" + @WKSTA + "\Administrators")
"Admin" ?
EndIf



Edited by Chris S. (2004-05-13 01:31 PM)

Top
#119481 - 2004-05-13 01:37 PM Re: Check if admn rights
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if the user is not added to local admins, how they would be admins anyways then?
_________________________
!

download KiXnet

Top
#119482 - 2004-05-13 01:56 PM Re: Check if admn rights
cellnet Offline
Starting to like KiXtart

Registered: 2002-02-26
Posts: 115
Loc: Sweden
Autenticated users are added to the local admin group.

Not the user himself.

Are you sure your code snippet works in this scenario

\erik


Top
#119483 - 2004-05-13 02:14 PM Re: Check if admn rights
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Detecting if a local will work with the previous response.

However, if we look at - Best Practices and Methods, we see:
Code:

$admin = ingroup(@wksta+'\'+sidtoname('S-1-5-32-544'))-1+@INWIN



if we expand upon this, we get -
Code:

cls
break on

$admin = ingroup(@wksta+'\'+sidtoname('S-1-5-32-544'))-1+@INWIN
?$admin

If $admin
?'you are a local admin'
else
?'you are not a local admin'
endif
get $



HTH,

Kent

_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#119484 - 2004-05-13 02:23 PM Re: Check if admn rights
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Quote:

Are you sure your code snippet works in this scenario





Yep.

Top
#119485 - 2004-05-13 02:43 PM Re: Check if admn rights
cellnet Offline
Starting to like KiXtart

Registered: 2002-02-26
Posts: 115
Loc: Sweden
thanks, works perfect with "expanded" code

Regards
\erik


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 (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.139 seconds in which 0.108 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