#113843 - 2004-02-11 10:15 PM
Re: Local Admin Members
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
You can use GrpMaint.exe as a standalone solution. You can enum remote servers and workstations. Or are you looking for a way to do this from within the logon script as a user?
|
Top
|
|
|
|
#113846 - 2004-02-11 10:44 PM
Re: Local Admin Members
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I can not understand the requirement for a user to enum the group. Can you tell us what exactly you want to get from this operation and how you intend to use the data? Code:
break On ? @kix ? ingroup("\\@wksta\administrators")
|
Top
|
|
|
|
#113848 - 2004-02-11 11:45 PM
Re: Local Admin Members
|
ShaneEP
MM club member
Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
|
This code should work to get all of the objects that are in the local admin group. I dont know how to tell the difference from users and groups however.
Code:
$memberfile = "%temp%\adminmembers.tmp" If Exist ($memberfile) Del $memberfile Endif Shell '%comspec% /c net localgroup administrators > '+$memberfile $members = ArrayEnumText($memberfile) Del $memberfile
For Each $member in $members ? $member Next
get $
FUNCTION ArrayEnumText($TextFile) Dim $TextHandle,$Line,$LineArray,$LineValue $TextHandle = FreeFileHandle() If Open ($TextHandle,$TextFile) = 0 While @Error = 0 and $trigger < 1 $Line = ReadLine ($TextHandle) If InStr ($line, "---") $trigger = 1 Endif Loop $LineValue = 0 While @Error = 0 $Line = ReadLine ($TextHandle) If Not InStr ($line, "The command completed successfully") ReDim Preserve $ArrayEnumText[$LineValue] $ArrayEnumText[$LineValue] = $Line $LineValue = $LineValue+1 Endif Loop $null = Close ($TextHandle) If UBound ($ArrayEnumText) >= 0 Exit 0 Else Exit 1 Endif Else Exit 1 Endif ENDFUNCTION
|
Top
|
|
|
|
#113852 - 2004-02-12 01:44 AM
Re: Local Admin Members
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
Yes, good code for 2000/XP there Lonk
However for NT 4 which was the original request it does not appear to work. I tested it on NT 4 SP6a workstation and NT 4 Server SP6a and neither one returned info.
So unless Lonk or someone else can figure out a pure KiXtart method, I'll suggest this.
NetLocalGroupEnum NetUserGetLocalGroups NetUserEnum
Using Win32 C,C++,VB,Perl,Python,etc... you could use
NetLocalGroupGetMembers
Otherwise you may have to locate a compiled .EXE or use WSH/ADSI to really accomplish this task.
Here is a tool that I think should do what you're looking to do, but I've not tested it on NT 4 http://www.joeware.net/win32/zips/Lg.zip
He also has a lot of other nice utilities for Admin work.
http://www.joeware.net/
|
Top
|
|
|
|
#113855 - 2004-02-12 03:07 AM
Re: Local Admin Members
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I would not have the user collect this info. Instead, I would have the computer create a flag file on a server indicating it is available for interogation. A server based process would then query the workstation for any info needed outside the logon process.
|
Top
|
|
|
|
#113857 - 2004-02-12 01:19 PM
Re: Local Admin Members
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Yes he did say that...but the reason I think he said that ADSI was not installed on his current NT4 clients. In the scanario I put forth, he would not need ADSI on the clients just the computer from where the admin script was executed.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 557 anonymous users online.
|
|
|