#139076 - 2005-05-04 09:26 PM
Re: Question about ComputerInGroup
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
This code is written using the the NT4 compatible WinNT:// ADSI provider. If you want to understand nested group memberships, then someone needs to investigate other methods Microsoft has to check group membership. If I get time, I may sift throught MSDN.microsoft.com to see if the LDAP ADSI provider support this. If Microsoft can perform this task, there is usually way for us to access that functionality.
|
|
Top
|
|
|
|
#139079 - 2005-05-04 09:50 PM
Re: Question about ComputerInGroup
|
oobnuker
Getting the hang of it
Registered: 2003-12-09
Posts: 87
Loc: Oxford, CT
|
Quote:
The question is why nest local groups in global groups in this case? Unless the local group is on a different resource than the global group, it makes no sense.
For me, I am trying to exclude the SMS client from being installed in the login script if a computer is a member of a certain group. At my site, each physical location only has the ability to manipulate users and computers in their own OU. So I made a global group PREMCOR_SMS_EXCLUSION, and then created local groups [SITE]_SMS_EXCLUSION under each OU for the local admins to use, with the local groups members of the global group. If this functionality existed, I could do something like:
Code:
if computeringroup('PREMCOR_SMS_EXCLUSION') Skip SMS else Install SMS endif
but instead, my if computeringroup line is off the charts having to include 10 individual OUs. Also, I consider our site to be relatively small, so I can imagine that the value of nested groups would increase with a larger site.
Maybe I am doing something wrong or overlooking something, but this is all I've got right now.
Edited by oobnuker (2005-05-04 09:51 PM)
_________________________
--
oobnuker - .KIX hack - no really.
|
|
Top
|
|
|
|
#139081 - 2005-05-04 10:41 PM
Re: Question about ComputerInGroup
|
maciep
Korg Regular
   
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
I think from what i remember, ADSI does not support nested groups. I haven't had a chance to test it but have you tried just using LDAP for the query
(pseudo code) Code:
if Getobject(AdsPathOfTheGroup).IsMember(AdsPathOfTheMachine) ; Exclude from SMS else ; Install SMS endif
|
|
Top
|
|
|
|
#139082 - 2005-05-05 02:55 PM
Re: Question about ComputerInGroup
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
This does not make me happy. 
From MSDN:
Quote:
Determining a User's or Group's Membership in a Group The IADsGroup.IsMember method can be used to determine if an object is a member of a group. This method returns TRUE if the specified object is a direct member of the group, that is, the group's member property contains the specified object.
A group can contain other groups. The IADsGroup.IsMember method does not recursively verify the members of groups in its member property, groups within those groups, and so on. To recursively verify that an object is a member of a group, enumerate the groups in the member property, verify the members of those groups to see if the object is a member, and if those groups contain other groups, check their members, and so on.
If you were to use a local group as parent SMS group, then this should be possible. In Perl I can use NetUserGetLocalGroups("", $user, &LG_INCLUDE_INDIRECT, \@groups) to get a list of all local groups the including indirect memberships from nested global groups.
http://msdn.microsoft.com/library/defaul...localgroups.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/iadsuser_groups.asp
I am testing the IADsUser::Groups functionality to see if the it lists my local group membership by indirect membership in a nested global group. Back in a view minutes.
|
|
Top
|
|
|
|
#139083 - 2005-05-05 03:41 PM
Re: Question about ComputerInGroup
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
No joy with the ADSI.
But this may work for you. It is not as clean as I would like but... Code:
Function InstallSMS() ; Create global groups in each OU using the naming format "OUname_NO_SMS" ; Add computers to these groups that do not get SMS Dim $Install_SMS $Install_SMS = 1 $oComputer = GetObject("WinNT://domain/" + @wksta + "$" + ",user") $GrpArray = $oComputer.Groups For Each $grp In $GrpArray if Right($grp,6) = "NO_SMS" $Install_SMS = 0 endif Next If $Install_SMS ;do something... Endif Endfunction
Fixed blatant screwup in object names.
Edited by Howard Bullock (2005-05-05 04:02 PM)
|
|
Top
|
|
|
|
#139085 - 2005-05-05 03:58 PM
Re: Question about ComputerInGroup
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I guess I should have stated that. I just quickly coded it for discussion and testing by those interested.
I did test the group listing loop with a standard user as a proof of concept to myself.
Edited by Howard Bullock (2005-05-05 03:58 PM)
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 871 anonymous users online.
|
|
|