Page 1 of 1 1
Topic Options
#146386 - 2005-08-24 05:00 PM Check for member of administrator group
Peak Offline
Fresh Scripter

Registered: 2004-05-24
Posts: 7
Running an old NT4 domain. How do I check i the global support group is member of the local administrator group?
Top
#146387 - 2005-08-24 05:18 PM Re: Check for member of administrator group
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
are you wanting to do this via a logon script or a admin script?

if logon script you could use ADSI to do this.ADSI comes with W2k and up but has to be installed on NT computers.

if an admin script, you need to have ADSI installed just on the computer that you are running the script from, and it will go out and check the other comptuers for you.

Might want to take a look at the groumembers() UDF.

Top
#146388 - 2005-08-24 05:26 PM Re: Check for member of administrator group
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Maybe Local.zip (part of W2K resource kit) can help. Tried and works also on my WXP Professional.
Code:
local administrators \\MyComputerName



Edited by Witto (2005-08-24 05:27 PM)

Top
#146389 - 2005-08-25 12:45 AM Re: Check for member of administrator group
BoxKite Offline
Da Box
*****

Registered: 2000-05-17
Posts: 282
Loc: Vacaville,CA,USA
Try this. It's for your computer. If you want to use in a login script you will need to create a data file to read-in the computer names, and a read/write location for the login script to send data.
Code:
$NCCgroup = getobject("WinNT://./administrators")
;Change Domain_HELPDESK to group you want to check

$checkvalue = "Domain_HELPDESK is not in local Admin Group" ; Domain_HELPDESK is Global Group to check
for each $member in $NCCgroup.members
if $member.name = "Domain_HELPDESK"
$checkvalue = "Domain_HELPDESK is in the local Admin Group"
endif
next
$NCCgroup = 0
? ? "$checkvalue" ? ? shell "%comspec% /c pause"

exit

_________________________
Box
FACTA NON VERBA

Top
#146390 - 2005-08-25 10:10 AM Re: Check for member of administrator group
Peak Offline
Fresh Scripter

Registered: 2004-05-24
Posts: 7
Thanks all especially BoxKite that was exactly what I was trying to accomplish. Is there any way to use the SID for the Administrator group instead of the name to make the script “multi language”?
Top
#146391 - 2005-08-25 02:49 PM Re: Check for member of administrator group
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
If this is an Admin script, you could use Win32Admin.DLL to return the name of the remote Admin group.

http://home.comcast.net/~habullock/kix_solutions.htm

GetAdminAccount(optional $Server)
Returns the name of the local BUILTIN\Administrator account.

This method is valuable when trying to locate an account that has been renamed or is not 'Administrator' because of OS language localization.

[edit]
oops.

grabbed the wrong text:

LocalAdminGrp(optional $Server)
Returns the name of the local BUILTIN\Administrators group on $Server.

This method is valuable when trying to locate a renamed or language localized group name. When $Server is NULL, the local computer is used. This method is valuable when trying to locate an account that has been renamed or is not 'Administrators' because of OS language localization.

[/edit]


Edited by Howard Bullock (2005-08-25 09:14 PM)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#146392 - 2005-08-25 08:15 PM Re: Check for member of administrator group
BoxKite Offline
Da Box
*****

Registered: 2000-05-17
Posts: 282
Loc: Vacaville,CA,USA
Here is how to find the group SID.

Make sure the group is on the computer you are using and run the following applet. NOTE: Don’t forget to use the single quotes on the where clause.

Code:
break on
$objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Group Where Name = 'global admin group name'")
For Each $objItem In $colItems
? "Name: " + $objItem.Name
? "SID: " + $objItem.SID
Next
? ? shell “%comspec% /c pause”
Exit

_________________________
Box
FACTA NON VERBA

Top
#146393 - 2005-08-25 09:16 PM Re: Check for member of administrator group
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Yes but you still need to lookup the name to use WMI. Win32Admin.DLL uses the well-known sid to return the group name.

It is strange why Microsoft always seem to write methods that require a name that can be localized but they omit the methods to lookup the localized name.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#146394 - 2005-08-25 11:36 PM Re: Check for member of administrator group
NTDOC Administrator Online   content
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Peak


There is this UDF which is quite similar, put together by Lonkero.

GetAdminAccount() - Retrieves Admin Account Info (name or sid)
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=143670

Top
#146395 - 2005-08-25 11:50 PM Re: Check for member of administrator group
BoxKite Offline
Da Box
*****

Registered: 2000-05-17
Posts: 282
Loc: Vacaville,CA,USA
I've never used Win32Admin.DLL. If using in an Admin script, does it need to be registered on each computer you want to touch?
_________________________
Box
FACTA NON VERBA

Top
#146396 - 2005-08-25 11:59 PM Re: Check for member of administrator group
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
no, only each computer you want the script running.
_________________________
!

download KiXnet

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 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.203 seconds in which 0.096 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