![]() |
|
|
|||||||
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
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? |
|
|
#2 |
|
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? > > |
|
|
#3 |
|
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? > > > > > > > |
|
|
#4 |
|
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? >> > >> > >> >> >> |
|
|
#5 |
|
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? |