The following code is part of my script that adds users to a group. How can
I change it to remove users from a group?

Thanks,
Jeremy

' Add (str)User to (str)Group
Set objUser = GetObject("LDAP://"& strUser _
& strOU & strDNSDomain)
Set objGroup = GetObject("LDAP://"& strGroup _
& strOU & strDNSDomain)
objGroup.add(objUser.ADsPath)

Re: remove user from group by Gareth

Gareth
Thu Feb 23 02:16:11 CST 2006

Hi,

Using the line objGroup.Remove(objUser.AdsPath) should work, have a look at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adam/adam/removing_members_from_groups.asp

Cheers

Gareth Brown | Consultant | 1E Ltd

www.1e.com


"Jeremy Schubert" <jschubert@shaw.ca> wrote in message
news:lj9Lf.62684$sa3.39241@pd7tw1no...
> The following code is part of my script that adds users to a group. How
> can I change it to remove users from a group?
>
> Thanks,
> Jeremy
>
> ' Add (str)User to (str)Group
> Set objUser = GetObject("LDAP://"& strUser _
> & strOU & strDNSDomain)
> Set objGroup = GetObject("LDAP://"& strGroup _
> & strOU & strDNSDomain)
> objGroup.add(objUser.ADsPath)
>