Richard
Wed Sep 17 09:04:12 CDT 2003
Bejoy Gangadharan wrote:
> is there a way to delete the group from a users ( member
> of ) attribute. I have users who already have some
> distribution groups defined, is there a way that i can get
> red of it and get it new ones there.
Hi,
The group object has a Remove method (and also an Add method). You would
bind to the group and invoke the Remove method to remove a user from the
group. You pass the AdsPath of the user to the method. I like to bind to the
user object so I'm sure I get the correct AdsPath. For example:
Set objUser = GetObject("LDAP://cn=TestUser,ou=Sales,dc=MyDomain,dc=com")
Set objGroup = GetObject("LDAP://cn=TestGroup,ou=Sales,dc=MyDomain,dc=com")
objGroup.Remove(objUser.AdsPath)
The Add method is the same.
--
Richard
Microsoft MVP Scripting and ADSI
HilltopLab web site -
http://www.rlmueller.net
--