Link to home
Start Free TrialLog in
Avatar of mahesh_gowda
mahesh_gowda

asked on

VB script to update distribution list

Need a VB script which will update "XYZ" distribution list membership from the related security group. All members (users and groups) of the distribution group are removed first.Then the related security group is fully expanded to include all members (users and groups). Finally, the members (users and groups) are added from the related security group
Avatar of kjanicke
kjanicke
Flag of United States of America image

Couldn't you just mail enable the security group, and use one group for both purposes?
Avatar of Chris Dent

Depending on your aim, it could be as simple as this. It simply overwrites the membership of the Destination Group with that from the Source Group.

Chris

Set objSourceGroup = GetObject("LDAP://CN=Source Group Name,OU=somewhere,DC=yourdomain,DC=com")
Set objDestGroup = GetObject("LDAP://CN=Dest Group Name,OU=somewhere,DC=yourdomain,DC=com")
 
objDestGroup.Put "member", objSourceGroup.GetEx("member")
objDestGroup.SetInfo

Open in new window

Avatar of mahesh_gowda
mahesh_gowda

ASKER

Hello Sage,
                    Thank you for your reply. We need to remove the member and we want the security group to expand fully to include all members. Can you let me know on this.

What do you mean by expand fully to include all members?

The above already removes existing members, simply because it completely overwrites any current membership.

Chris
Hello Chris,
                  Thank you!!  Is there a possibility for us to get a mail once the update is done? Can you help me on that?
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial