Page 1 of 1 1
Topic Options
#50834 - 2000-08-01 07:19 PM Checking if Domain group is in local group
Anonymous
Unregistered


I have created a domain group called "NT Install" and have added it to most NT workstation's local "Administrators" group. Is there a way to check if the "NT Install" group is in the local "Administrators" group?

I use ingroup to check if the user is in the "NT Install" group but users are only in this temporarily and I would like to catch PCs that have not been updated locally. Hope this makes sense.

Top
#50835 - 2000-08-01 08:04 PM Re: Checking if Domain group is in local group
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL

this will only work if the user is a local admin

$admincmd="cmd /c NET LOCALGROUP administrators domain\group /add 2>nul"
shell "$admincmd"

If they are not local admins, you will need to use something like SU

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#50836 - 2000-08-01 09:07 PM Re: Checking if Domain group is in local group
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
this is a little bit on the rough side but it should get the job done.

code:

break on cls
; This script needs the NT Resource Kit tool "LOCAL"
; You also need a list of target computer to scan, the list must be in the UNC format
; \\computer1
; \\computer2
; ....
;------------------------------------------------------------------------------------

$file = "clist.dat" ;A target list of computers to scan
$tempfile = "temp.txt"
$globalgroup = "Domain Admins" ;The global group that you are searching for
$localgroup = "Administrators" ;the local group that you are looking for $globalgroup in

$q = open(1,$file,2)
$computer = readline(1)
do
select
case exist("$computer\admin$\") = 1
shell '%comspec% /c local $localgroup $computer | find /i "$globalgroup" > $tempfile'
if getfilesize("$tempfile") <> 0
$q = open(2,$tempfile,2)
$return = readline(2)
$q = close(2)
del $tempfile
? "$Computer has Global group $return in the local $localgroup"
Else
? "$globalgroup can not be found the the local $localgroup"
endif
case exist("$computer\admin$\") = 0
? "Can't connect to $computer OR you have insufecent rights"

endselect
$computer = readline(1)
until @error <> 0
$q = close(1)
exit


Bryce

Top
#50837 - 2000-08-02 03:55 PM Re: Checking if Domain group is in local group
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Just to let you know I have a script that will pull the names of all NT computers from the PDC and create a list of those computers.
http://www.neosoft.com/~brycel/kix/other_scripts/Computer_List/

Also, I have found a wonderful use for the "Global in Local" scanning script! Playing around with it last night I found out that 2 of my NT computers have the global group "Domain users" in the local "Administrators" group.

This script has some great potential to become a tool to be used in a system audit

Bryce

Top
#50838 - 2000-08-02 07:32 PM Re: Checking if Domain group is in local group
Anonymous
Unregistered


The scanning script works pretty good and should do the job. Thanks.
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 1452 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.055 seconds in which 0.026 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