TechTalkz.com Logo Ask the Experts!

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Tech Support Archives > Microsoft > Windows Server 2003

clear current members of a distrib grp and add new members from a

Windows Server 2003

 
 
 
Thread Tools Display Modes
Old 06-05-2008, 08:14 AM   #1
Phil
Guest
 
Posts: n/a
clear current members of a distrib grp and add new members from a

2003 AD, Native forest and Domain.
XP SP2 clients.

I need to script up a way of clearing all current members for an AD
Distribution Group and then adding back in all the members from a .txt or
..csv file.

The script needs to be able to be run by users that have permissions to the
AD group object.

Any ideas?


 
Old 06-05-2008, 01:14 PM   #2
Paul Bergson [MVP-DS]
Guest
 
Posts: n/a
Re: clear current members of a distrib grp and add new members from a

## Clear the group ##

Set objGroup = GetObject
("LDAP://cn=GroupName,ou=SomeOU,dc=domainName,dc=com")

objGroup.PutEx ADS_PROPERTY_CLEAR, "member", 0

objGroup.SetInfo



## Add user to the group ##

Set objGroup = GetObject _

("LDAP://cn=GroupName,ou=SomeOU,dc=domainName,dc=com")

objGroup.PutEx ADS_PROPERTY_APPEND, "member", Array(DistinguishedName)

objGroup.SetInfo


This should all be available at:
http://www.microsoft.com/technet/scr....mspx?mfr=true

--
Paul Bergson
MVP - Directory Services
MCTS, MCT, MCSE, MCSA, Security+, BS CSci
2008, 2003, 2000 (Early Achiever), NT4

http://www.pbbergs.com

Please no e-mails, any questions should be posted in the NewsGroup
This posting is provided "AS IS" with no warranties, and confers no rights.

"Phil" <Phil@discussions.microsoft.com> wrote in message
news:35EB0503-0310-48C8-8317-119080743636@microsoft.com...
> 2003 AD, Native forest and Domain.
> XP SP2 clients.
>
> I need to script up a way of clearing all current members for an AD
> Distribution Group and then adding back in all the members from a .txt or
> .csv file.
>
> The script needs to be able to be run by users that have permissions to
> the
> AD group object.
>
> Any ideas?
>
>



 
Old 07-05-2008, 01:21 AM   #3
Phil
Guest
 
Posts: n/a
Re: clear current members of a distrib grp and add new members fro

Thanks Paul.

In the ## Add user to the group ## section, how do I get it to read the list
of users to be added to the group in from a .txt or .csv file etc.

Phil


"Paul Bergson [MVP-DS]" wrote:

> ## Clear the group ##
>
> Set objGroup = GetObject
> ("LDAP://cn=GroupName,ou=SomeOU,dc=domainName,dc=com")
>
> objGroup.PutEx ADS_PROPERTY_CLEAR, "member", 0
>
> objGroup.SetInfo
>
>
>
> ## Add user to the group ##
>
> Set objGroup = GetObject _
>
> ("LDAP://cn=GroupName,ou=SomeOU,dc=domainName,dc=com")
>
> objGroup.PutEx ADS_PROPERTY_APPEND, "member", Array(DistinguishedName)
>
> objGroup.SetInfo
>
>
> This should all be available at:
> http://www.microsoft.com/technet/scr....mspx?mfr=true
>
> --
> Paul Bergson
> MVP - Directory Services
> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
> 2008, 2003, 2000 (Early Achiever), NT4
>
> http://www.pbbergs.com
>
> Please no e-mails, any questions should be posted in the NewsGroup
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Phil" <Phil@discussions.microsoft.com> wrote in message
> news:35EB0503-0310-48C8-8317-119080743636@microsoft.com...
> > 2003 AD, Native forest and Domain.
> > XP SP2 clients.
> >
> > I need to script up a way of clearing all current members for an AD
> > Distribution Group and then adding back in all the members from a .txt or
> > .csv file.
> >
> > The script needs to be able to be run by users that have permissions to
> > the
> > AD group object.
> >
> > Any ideas?
> >
> >

>
>
>

 
Old 07-05-2008, 01:15 PM   #4
Paul Bergson [MVP-DS]
Guest
 
Posts: n/a
Re: clear current members of a distrib grp and add new members fro

If you go to the script center from the link I provided you should be able
to find examples on reading a text file.

--
Paul Bergson
MVP - Directory Services
MCTS, MCT, MCSE, MCSA, Security+, BS CSci
2008, 2003, 2000 (Early Achiever), NT4

http://www.pbbergs.com

Please no e-mails, any questions should be posted in the NewsGroup
This posting is provided "AS IS" with no warranties, and confers no rights.

"Phil" <Phil@discussions.microsoft.com> wrote in message
news:337995B3-1701-4368-903F-1E28A5271DD2@microsoft.com...
> Thanks Paul.
>
> In the ## Add user to the group ## section, how do I get it to read the
> list
> of users to be added to the group in from a .txt or .csv file etc.
>
> Phil
>
>
> "Paul Bergson [MVP-DS]" wrote:
>
>> ## Clear the group ##
>>
>> Set objGroup = GetObject
>> ("LDAP://cn=GroupName,ou=SomeOU,dc=domainName,dc=com")
>>
>> objGroup.PutEx ADS_PROPERTY_CLEAR, "member", 0
>>
>> objGroup.SetInfo
>>
>>
>>
>> ## Add user to the group ##
>>
>> Set objGroup = GetObject _
>>
>> ("LDAP://cn=GroupName,ou=SomeOU,dc=domainName,dc=com")
>>
>> objGroup.PutEx ADS_PROPERTY_APPEND, "member", Array(DistinguishedName)
>>
>> objGroup.SetInfo
>>
>>
>> This should all be available at:
>> http://www.microsoft.com/technet/scr....mspx?mfr=true
>>
>> --
>> Paul Bergson
>> MVP - Directory Services
>> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
>> 2008, 2003, 2000 (Early Achiever), NT4
>>
>> http://www.pbbergs.com
>>
>> Please no e-mails, any questions should be posted in the NewsGroup
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "Phil" <Phil@discussions.microsoft.com> wrote in message
>> news:35EB0503-0310-48C8-8317-119080743636@microsoft.com...
>> > 2003 AD, Native forest and Domain.
>> > XP SP2 clients.
>> >
>> > I need to script up a way of clearing all current members for an AD
>> > Distribution Group and then adding back in all the members from a .txt
>> > or
>> > .csv file.
>> >
>> > The script needs to be able to be run by users that have permissions to
>> > the
>> > AD group object.
>> >
>> > Any ideas?
>> >
>> >

>>
>>
>>



 
Old 20-05-2008, 07:22 PM   #5
Jorge de Almeida Pinto [MVP - DS]
Guest
 
Posts: n/a
Re: clear current members of a distrib grp and add new members from a

how about using a batch with ADFIND/ADMOD?

goto joeware.net for those tools

--

Cheers,
(HOPEFULLY THIS INFORMATION HELPS YOU!)

# Jorge de Almeida Pinto # MVP Identity & Access - Directory Services #

BLOG (WEB-BASED)--> http://blogs.dirteam.com/blogs/jorge/default.aspx
BLOG (RSS-FEEDS)--> http://blogs.dirteam.com/blogs/jorge/rss.aspx
------------------------------------------------------------------------------------------
* How to ask a question --> http://support.microsoft.com/?id=555375
------------------------------------------------------------------------------------------
* This posting is provided "AS IS" with no warranties and confers no rights!
* Always test ANY suggestion in a test environment before implementing!
------------------------------------------------------------------------------------------
#################################################
#################################################
------------------------------------------------------------------------------------------
"Phil" <Phil@discussions.microsoft.com> wrote in message
news:35EB0503-0310-48C8-8317-119080743636@microsoft.com...
> 2003 AD, Native forest and Domain.
> XP SP2 clients.
>
> I need to script up a way of clearing all current members for an AD
> Distribution Group and then adding back in all the members from a .txt or
> .csv file.
>
> The script needs to be able to be run by users that have permissions to
> the
> AD group object.
>
> Any ideas?
>
>


 
 

Thread Tools
Display Modes



< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT. The time now is 01:44 AM.


vBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2013, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional