Page 1 of 1 1
Topic Options
#41697 - 2003-06-18 01:18 AM check for Global group in Local Group
j95661 Offline
Getting the hang of it

Registered: 2001-02-27
Posts: 84
Loc: sacramento,ca usa
I am currently using the below to see if several Global Groups are in the workstations Local Administrators group. Is there a function in Kix that I could do this faster, less shell-y. This works fine but I would rather use a built in function.

thanks
code:
$group = "@domain\domain admins"
Shell '%comspec% /c net localgroup administrators | find /i "$group" > nul'
If @error = 1
Shell '%comspec% /c net localgroup administrators "$group" /add > nul'
EndIf

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

Top
#41698 - 2003-06-18 01:24 AM Re: check for Global group in Local Group
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
here is one..
GroupMembers() - returns all members of a given group

but I know I saw one that was less... verbose... [Big Grin]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#41699 - 2003-06-18 01:36 AM Re: check for Global group in Local Group
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
check out the posts in this thread http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=2;t=003869#000001.

Look for use of the ADSI method "IsMember" that check to see if an account is a member of a group. In your case, the $account variable would be the global group ADsPath.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#41700 - 2003-06-18 03:37 PM Re: check for Global group in Local Group
Ganiman Offline
Fresh Scripter

Registered: 2003-06-10
Posts: 23
Loc: Rhode Island
I believe WMIQuery() can also find that information for you. Try using it with an OS class. This link might prove to be useful for you; it has for me.

Microsoft - Operating System Classes
_________________________
Ganiman

Top
#41701 - 2003-06-18 04:00 PM Re: check for Global group in Local Group
Radimus Moderator Offline
Moderator
*****

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

for each $obj in WMIQuery('fullname', 'Win32_UserAccount',, 'name', @userid)
? $obj
next

and this sort of works...
for each $obj in WMIQuery('PartComponent', 'Win32_GroupUser',)
? $obj
next

[ 18. June 2003, 16:06: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

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 (Allen) and 781 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.122 seconds in which 0.01 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