Page 1 of 1 1
Topic Options
#123115 - 2004-07-16 07:28 AM faster ingroup "local admins"
j95661 Offline
Getting the hang of it

Registered: 2001-02-27
Posts: 84
Loc: sacramento,ca usa
For some time now I have been using ingroup in my login script to determine Local Administrative rights. For some reason in our enviornment ingroup takes a considerable amount of time especially at remote locations. After digging into my old batch goodie bag I came up with the following section to add to my script. It has made a tremendous difference for determining local administrative rights. If your enviornment doesnt add users to the local administrators group you wont see any difference.

Code:
 

Shell '%comspec% /c net localgroup administrators | find /i "@USERID" > nul'
If @error = 0
$LoAdmin = "TRUE"
Else
If InGroup("\\" + @WKSTA + "\Administrators") = 1
$LoAdmin = "TRUE"
EndIf
EndIf


_________________________
WonderBoy Constantly learning everyday, how much I dont know :-)

Top
#123116 - 2004-07-16 01:56 PM Re: faster ingroup "local admins"
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
From 4.x on ingroup checks global group membership from the user's authentication token and also has a local registry cache. Previous versions always made a roundtrip to a server or DC. What version of KiXtart are you using?

Also, have you triedsomething like:

Code:
	$Admin = 1
If not InGroup( "\\" + @wksta + "\" + SidToName( "S-1-5-32-544" ) )
$Admin=0
Endif

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#123117 - 2004-07-16 02:25 PM Re: faster ingroup "local admins"
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
did you mean:
Code:

$Admin = InGroup( @wksta + "\" + SidToName( "S-1-5-32-544" ) )



just had to golf...
_________________________
!

download KiXnet

Top
#123118 - 2004-07-16 03:12 PM Re: faster ingroup "local admins"
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
And... This is talked about in the Best Known Methods FAQ right here!

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

Top
#123119 - 2004-07-16 08:04 PM Re: faster ingroup "local admins"
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Yeah that's what I meant. Old code...Can I send all my code up there for optimization?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#123120 - 2004-07-17 05:32 AM Re: faster ingroup "local admins"
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
sure.
_________________________
!

download KiXnet

Top
#123121 - 2004-07-18 05:50 PM Re: faster ingroup "local admins"
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Or Jooel could release his Automated KiXtart Code Optimizer UDF.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 84 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.056 seconds in which 0.024 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