Go Back   TechArena Community > Technical Support > Computer Help > Windows Server > Active Directory
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , ,

Sponsored Links



Add users to Group via Script - [WP]

Active Directory


Reply
 
Thread Tools Search this Thread
  #1  
Old 29-01-2008
WILDPACKET
 
Posts: n/a
Add users to Group via Script - [WP]


I have a Sharepoint Group in AD. I want to run some sort of script
(everyday) which adds all the users from our AD with and without emails to
this group. But I want the script to check that if the users already exist
in the group ... do not add them instead move on and only add the newly
created users to this group.

If possible generate a small text file about the results on the script ran.

IS this possible?

TIA
Reply With Quote
  #2  
Old 29-01-2008
Dean Wells \(MVP\)
 
Posts: n/a
Re: Add users to Group via Script - [WP]

Addin the users to the group is fairly trivial but I'm interested to
know why you do not want to re-add members that already exist since
nothing bad will happen if you do so?

--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
news:AD0327B7-0C6B-4682-979E-DF40DCC869F5@microsoft.com...
>
> I have a Sharepoint Group in AD. I want to run some sort of script
> (everyday) which adds all the users from our AD with and without
> emails to
> this group. But I want the script to check that if the users already
> exist
> in the group ... do not add them instead move on and only add the
> newly
> created users to this group.
>
> If possible generate a small text file about the results on the script
> ran.
>
> IS this possible?
>
> TIA



Reply With Quote
  #3  
Old 29-01-2008
Paul Bergson [MVP-DS]
 
Posts: n/a
Re: Add users to Group via Script - [WP]

Build a list of all current members into a table
http://www.microsoft.com/technet/scr....mspx?mfr=true

Build a second table of all users in AD
http://techtasks.com/code/viewbookcode/1581

Compare the two tables and insert members that are not in the security group
http://www.microsoft.com/technet/scr....mspx?mfr=true


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

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.

"WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
news:AD0327B7-0C6B-4682-979E-DF40DCC869F5@microsoft.com...
>
> I have a Sharepoint Group in AD. I want to run some sort of script
> (everyday) which adds all the users from our AD with and without emails to
> this group. But I want the script to check that if the users already
> exist
> in the group ... do not add them instead move on and only add the newly
> created users to this group.
>
> If possible generate a small text file about the results on the script
> ran.
>
> IS this possible?
>
> TIA



Reply With Quote
  #4  
Old 29-01-2008
WILDPACKET
 
Posts: n/a
Re: Add users to Group via Script - [WP]


Thank you for your respons.

Will re-adding create an issue? Thats what I am not sure.


"Dean Wells (MVP)" wrote:

> Addin the users to the group is fairly trivial but I'm interested to
> know why you do not want to re-add members that already exist since
> nothing bad will happen if you do so?
>
> --
> Dean Wells [MVP / Directory Services]
> MSEtechnology
> [[ Please respond to the Newsgroup only regarding posts ]]
> R e m o v e t h e m a s k t o s e n d e m a i l
>
>
> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
> news:AD0327B7-0C6B-4682-979E-DF40DCC869F5@microsoft.com...
> >
> > I have a Sharepoint Group in AD. I want to run some sort of script
> > (everyday) which adds all the users from our AD with and without
> > emails to
> > this group. But I want the script to check that if the users already
> > exist
> > in the group ... do not add them instead move on and only add the
> > newly
> > created users to this group.
> >
> > If possible generate a small text file about the results on the script
> > ran.
> >
> > IS this possible?
> >
> > TIA

>
>
>

Reply With Quote
  #5  
Old 29-01-2008
Dean Wells \(MVP\)
 
Posts: n/a
Re: Add users to Group via Script - [WP]

No, it will be ignored.

Now we've got that piece established, could I ask how many members are
we talking about? What's the functional level of the forest? How many
DCs?

--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
news:3BB767E2-4475-45A9-B786-C411670993B2@microsoft.com...
>
> Thank you for your respons.
>
> Will re-adding create an issue? Thats what I am not sure.
>
>
> "Dean Wells (MVP)" wrote:
>
>> Addin the users to the group is fairly trivial but I'm interested to
>> know why you do not want to re-add members that already exist since
>> nothing bad will happen if you do so?
>>
>> --
>> Dean Wells [MVP / Directory Services]
>> MSEtechnology
>> [[ Please respond to the Newsgroup only regarding posts ]]
>> R e m o v e t h e m a s k t o s e n d e m a i l
>>
>>
>> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
>> news:AD0327B7-0C6B-4682-979E-DF40DCC869F5@microsoft.com...
>> >
>> > I have a Sharepoint Group in AD. I want to run some sort of script
>> > (everyday) which adds all the users from our AD with and without
>> > emails to
>> > this group. But I want the script to check that if the users
>> > already
>> > exist
>> > in the group ... do not add them instead move on and only add the
>> > newly
>> > created users to this group.
>> >
>> > If possible generate a small text file about the results on the
>> > script
>> > ran.
>> >
>> > IS this possible?
>> >
>> > TIA

>>
>>
>>



Reply With Quote
  #6  
Old 29-01-2008
WILDPACKET
 
Posts: n/a
Re: Add users to Group via Script - [WP]


Thank you Dean.

forest level 2003
AD users 1200
13 DCs 3 in head office and others in remote sites - highs speed connections




"Dean Wells (MVP)" wrote:

> No, it will be ignored.
>
> Now we've got that piece established, could I ask how many members are
> we talking about? What's the functional level of the forest? How many
> DCs?
>
> --
> Dean Wells [MVP / Directory Services]
> MSEtechnology
> [[ Please respond to the Newsgroup only regarding posts ]]
> R e m o v e t h e m a s k t o s e n d e m a i l
>
>
> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
> news:3BB767E2-4475-45A9-B786-C411670993B2@microsoft.com...
> >
> > Thank you for your respons.
> >
> > Will re-adding create an issue? Thats what I am not sure.
> >
> >
> > "Dean Wells (MVP)" wrote:
> >
> >> Addin the users to the group is fairly trivial but I'm interested to
> >> know why you do not want to re-add members that already exist since
> >> nothing bad will happen if you do so?
> >>
> >> --
> >> Dean Wells [MVP / Directory Services]
> >> MSEtechnology
> >> [[ Please respond to the Newsgroup only regarding posts ]]
> >> R e m o v e t h e m a s k t o s e n d e m a i l
> >>
> >>
> >> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
> >> news:AD0327B7-0C6B-4682-979E-DF40DCC869F5@microsoft.com...
> >> >
> >> > I have a Sharepoint Group in AD. I want to run some sort of script
> >> > (everyday) which adds all the users from our AD with and without
> >> > emails to
> >> > this group. But I want the script to check that if the users
> >> > already
> >> > exist
> >> > in the group ... do not add them instead move on and only add the
> >> > newly
> >> > created users to this group.
> >> >
> >> > If possible generate a small text file about the results on the
> >> > script
> >> > ran.
> >> >
> >> > IS this possible?
> >> >
> >> > TIA
> >>
> >>
> >>

>
>
>

Reply With Quote
  #7  
Old 29-01-2008
Dean Wells \(MVP\)
 
Posts: n/a
Re: Add users to Group via Script - [WP]

Cool, so in light of the stuff we just mentioned, how do you want to add
the users now? I ask for a number of reasons but especially since I'm
wondering if simply adding the Domain Users group would suffice?

--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
news:EEA630D6-1D9D-4BB1-AD4E-4F83A08ADD18@microsoft.com...
>
> Thank you Dean.
>
> forest level 2003
> AD users 1200
> 13 DCs 3 in head office and others in remote sites - highs speed
> connections
>
>
>
>
> "Dean Wells (MVP)" wrote:
>
>> No, it will be ignored.
>>
>> Now we've got that piece established, could I ask how many members
>> are
>> we talking about? What's the functional level of the forest? How
>> many
>> DCs?
>>
>> --
>> Dean Wells [MVP / Directory Services]
>> MSEtechnology
>> [[ Please respond to the Newsgroup only regarding posts ]]
>> R e m o v e t h e m a s k t o s e n d e m a i l
>>
>>
>> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
>> news:3BB767E2-4475-45A9-B786-C411670993B2@microsoft.com...
>> >
>> > Thank you for your respons.
>> >
>> > Will re-adding create an issue? Thats what I am not sure.
>> >
>> >
>> > "Dean Wells (MVP)" wrote:
>> >
>> >> Addin the users to the group is fairly trivial but I'm interested
>> >> to
>> >> know why you do not want to re-add members that already exist
>> >> since
>> >> nothing bad will happen if you do so?
>> >>
>> >> --
>> >> Dean Wells [MVP / Directory Services]
>> >> MSEtechnology
>> >> [[ Please respond to the Newsgroup only regarding posts ]]
>> >> R e m o v e t h e m a s k t o s e n d e m a i l
>> >>
>> >>
>> >> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in
>> >> message
>> >> news:AD0327B7-0C6B-4682-979E-DF40DCC869F5@microsoft.com...
>> >> >
>> >> > I have a Sharepoint Group in AD. I want to run some sort of
>> >> > script
>> >> > (everyday) which adds all the users from our AD with and without
>> >> > emails to
>> >> > this group. But I want the script to check that if the users
>> >> > already
>> >> > exist
>> >> > in the group ... do not add them instead move on and only add
>> >> > the
>> >> > newly
>> >> > created users to this group.
>> >> >
>> >> > If possible generate a small text file about the results on the
>> >> > script
>> >> > ran.
>> >> >
>> >> > IS this possible?
>> >> >
>> >> > TIA
>> >>
>> >>
>> >>

>>
>>
>>



Reply With Quote
  #8  
Old 29-01-2008
WILDPACKET
 
Posts: n/a
Re: Add users to Group via Script - [WP]


USers all over the AD in different OUs ...so will have to pick up all the
users from the AD and add to the Sharepoint Gorup

"Dean Wells (MVP)" wrote:

> Cool, so in light of the stuff we just mentioned, how do you want to add
> the users now? I ask for a number of reasons but especially since I'm
> wondering if simply adding the Domain Users group would suffice?
>
> --
> Dean Wells [MVP / Directory Services]
> MSEtechnology
> [[ Please respond to the Newsgroup only regarding posts ]]
> R e m o v e t h e m a s k t o s e n d e m a i l
>
>
> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
> news:EEA630D6-1D9D-4BB1-AD4E-4F83A08ADD18@microsoft.com...
> >
> > Thank you Dean.
> >
> > forest level 2003
> > AD users 1200
> > 13 DCs 3 in head office and others in remote sites - highs speed
> > connections
> >
> >
> >
> >
> > "Dean Wells (MVP)" wrote:
> >
> >> No, it will be ignored.
> >>
> >> Now we've got that piece established, could I ask how many members
> >> are
> >> we talking about? What's the functional level of the forest? How
> >> many
> >> DCs?
> >>
> >> --
> >> Dean Wells [MVP / Directory Services]
> >> MSEtechnology
> >> [[ Please respond to the Newsgroup only regarding posts ]]
> >> R e m o v e t h e m a s k t o s e n d e m a i l
> >>
> >>
> >> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
> >> news:3BB767E2-4475-45A9-B786-C411670993B2@microsoft.com...
> >> >
> >> > Thank you for your respons.
> >> >
> >> > Will re-adding create an issue? Thats what I am not sure.
> >> >
> >> >
> >> > "Dean Wells (MVP)" wrote:
> >> >
> >> >> Addin the users to the group is fairly trivial but I'm interested
> >> >> to
> >> >> know why you do not want to re-add members that already exist
> >> >> since
> >> >> nothing bad will happen if you do so?
> >> >>
> >> >> --
> >> >> Dean Wells [MVP / Directory Services]
> >> >> MSEtechnology
> >> >> [[ Please respond to the Newsgroup only regarding posts ]]
> >> >> R e m o v e t h e m a s k t o s e n d e m a i l
> >> >>
> >> >>
> >> >> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in
> >> >> message
> >> >> news:AD0327B7-0C6B-4682-979E-DF40DCC869F5@microsoft.com...
> >> >> >
> >> >> > I have a Sharepoint Group in AD. I want to run some sort of
> >> >> > script
> >> >> > (everyday) which adds all the users from our AD with and without
> >> >> > emails to
> >> >> > this group. But I want the script to check that if the users
> >> >> > already
> >> >> > exist
> >> >> > in the group ... do not add them instead move on and only add
> >> >> > the
> >> >> > newly
> >> >> > created users to this group.
> >> >> >
> >> >> > If possible generate a small text file about the results on the
> >> >> > script
> >> >> > ran.
> >> >> >
> >> >> > IS this possible?
> >> >> >
> >> >> > TIA
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>

>
>
>

Reply With Quote
  #9  
Old 29-01-2008
Dean Wells \(MVP\)
 
Posts: n/a
Re: Add users to Group via Script - [WP]

.... nod, but since _all_ users are, by default, a member of 'Domain
Users' --> nesting this group in the SharePoint group will achieve that
end??

--
Dean Wells [MVP / Directory Services]
MSEtechnology
[[ Please respond to the Newsgroup only regarding posts ]]
R e m o v e t h e m a s k t o s e n d e m a i l


"WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
news:40C78334-1790-413C-805D-EB77D941405B@microsoft.com...
>
> USers all over the AD in different OUs ...so will have to pick up all
> the
> users from the AD and add to the Sharepoint Gorup
>
> "Dean Wells (MVP)" wrote:
>
>> Cool, so in light of the stuff we just mentioned, how do you want to
>> add
>> the users now? I ask for a number of reasons but especially since
>> I'm
>> wondering if simply adding the Domain Users group would suffice?
>>
>> --
>> Dean Wells [MVP / Directory Services]
>> MSEtechnology
>> [[ Please respond to the Newsgroup only regarding posts ]]
>> R e m o v e t h e m a s k t o s e n d e m a i l
>>
>>
>> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
>> news:EEA630D6-1D9D-4BB1-AD4E-4F83A08ADD18@microsoft.com...
>> >
>> > Thank you Dean.
>> >
>> > forest level 2003
>> > AD users 1200
>> > 13 DCs 3 in head office and others in remote sites - highs speed
>> > connections
>> >
>> >
>> >
>> >
>> > "Dean Wells (MVP)" wrote:
>> >
>> >> No, it will be ignored.
>> >>
>> >> Now we've got that piece established, could I ask how many members
>> >> are
>> >> we talking about? What's the functional level of the forest? How
>> >> many
>> >> DCs?
>> >>
>> >> --
>> >> Dean Wells [MVP / Directory Services]
>> >> MSEtechnology
>> >> [[ Please respond to the Newsgroup only regarding posts ]]
>> >> R e m o v e t h e m a s k t o s e n d e m a i l
>> >>
>> >>
>> >> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in
>> >> message
>> >> news:3BB767E2-4475-45A9-B786-C411670993B2@microsoft.com...
>> >> >
>> >> > Thank you for your respons.
>> >> >
>> >> > Will re-adding create an issue? Thats what I am not sure.
>> >> >
>> >> >
>> >> > "Dean Wells (MVP)" wrote:
>> >> >
>> >> >> Addin the users to the group is fairly trivial but I'm
>> >> >> interested
>> >> >> to
>> >> >> know why you do not want to re-add members that already exist
>> >> >> since
>> >> >> nothing bad will happen if you do so?
>> >> >>
>> >> >> --
>> >> >> Dean Wells [MVP / Directory Services]
>> >> >> MSEtechnology
>> >> >> [[ Please respond to the Newsgroup only regarding posts ]]
>> >> >> R e m o v e t h e m a s k t o s e n d e m a i l
>> >> >>
>> >> >>
>> >> >> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in
>> >> >> message
>> >> >> news:AD0327B7-0C6B-4682-979E-DF40DCC869F5@microsoft.com...
>> >> >> >
>> >> >> > I have a Sharepoint Group in AD. I want to run some sort of
>> >> >> > script
>> >> >> > (everyday) which adds all the users from our AD with and
>> >> >> > without
>> >> >> > emails to
>> >> >> > this group. But I want the script to check that if the
>> >> >> > users
>> >> >> > already
>> >> >> > exist
>> >> >> > in the group ... do not add them instead move on and only add
>> >> >> > the
>> >> >> > newly
>> >> >> > created users to this group.
>> >> >> >
>> >> >> > If possible generate a small text file about the results on
>> >> >> > the
>> >> >> > script
>> >> >> > ran.
>> >> >> >
>> >> >> > IS this possible?
>> >> >> >
>> >> >> > TIA
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>

>>
>>
>>



Reply With Quote
  #10  
Old 30-01-2008
Paul Bergson [MVP-DS]
 
Posts: n/a
Re: Add users to Group via Script - [WP]

Oh good point Dean, I can't believe I missed that.

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

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.

"Dean Wells (MVP)" <dwells@maskmsetechnology.com> wrote in message
news:%23E3OyvoYIHA.484@TK2MSFTNGP06.phx.gbl...
> ... nod, but since _all_ users are, by default, a member of 'Domain
> Users' --> nesting this group in the SharePoint group will achieve that
> end??
>
> --
> Dean Wells [MVP / Directory Services]
> MSEtechnology
> [[ Please respond to the Newsgroup only regarding posts ]]
> R e m o v e t h e m a s k t o s e n d e m a i l
>
>
> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
> news:40C78334-1790-413C-805D-EB77D941405B@microsoft.com...
>>
>> USers all over the AD in different OUs ...so will have to pick up all the
>> users from the AD and add to the Sharepoint Gorup
>>
>> "Dean Wells (MVP)" wrote:
>>
>>> Cool, so in light of the stuff we just mentioned, how do you want to add
>>> the users now? I ask for a number of reasons but especially since I'm
>>> wondering if simply adding the Domain Users group would suffice?
>>>
>>> --
>>> Dean Wells [MVP / Directory Services]
>>> MSEtechnology
>>> [[ Please respond to the Newsgroup only regarding posts ]]
>>> R e m o v e t h e m a s k t o s e n d e m a i l
>>>
>>>
>>> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
>>> news:EEA630D6-1D9D-4BB1-AD4E-4F83A08ADD18@microsoft.com...
>>> >
>>> > Thank you Dean.
>>> >
>>> > forest level 2003
>>> > AD users 1200
>>> > 13 DCs 3 in head office and others in remote sites - highs speed
>>> > connections
>>> >
>>> >
>>> >
>>> >
>>> > "Dean Wells (MVP)" wrote:
>>> >
>>> >> No, it will be ignored.
>>> >>
>>> >> Now we've got that piece established, could I ask how many members
>>> >> are
>>> >> we talking about? What's the functional level of the forest? How
>>> >> many
>>> >> DCs?
>>> >>
>>> >> --
>>> >> Dean Wells [MVP / Directory Services]
>>> >> MSEtechnology
>>> >> [[ Please respond to the Newsgroup only regarding posts ]]
>>> >> R e m o v e t h e m a s k t o s e n d e m a i l
>>> >>
>>> >>
>>> >> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message
>>> >> news:3BB767E2-4475-45A9-B786-C411670993B2@microsoft.com...
>>> >> >
>>> >> > Thank you for your respons.
>>> >> >
>>> >> > Will re-adding create an issue? Thats what I am not sure.
>>> >> >
>>> >> >
>>> >> > "Dean Wells (MVP)" wrote:
>>> >> >
>>> >> >> Addin the users to the group is fairly trivial but I'm interested
>>> >> >> to
>>> >> >> know why you do not want to re-add members that already exist
>>> >> >> since
>>> >> >> nothing bad will happen if you do so?
>>> >> >>
>>> >> >> --
>>> >> >> Dean Wells [MVP / Directory Services]
>>> >> >> MSEtechnology
>>> >> >> [[ Please respond to the Newsgroup only regarding posts ]]
>>> >> >> R e m o v e t h e m a s k t o s e n d e m a i l
>>> >> >>
>>> >> >>
>>> >> >> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in
>>> >> >> message
>>> >> >> news:AD0327B7-0C6B-4682-979E-DF40DCC869F5@microsoft.com...
>>> >> >> >
>>> >> >> > I have a Sharepoint Group in AD. I want to run some sort of
>>> >> >> > script
>>> >> >> > (everyday) which adds all the users from our AD with and without
>>> >> >> > emails to
>>> >> >> > this group. But I want the script to check that if the users
>>> >> >> > already
>>> >> >> > exist
>>> >> >> > in the group ... do not add them instead move on and only add
>>> >> >> > the
>>> >> >> > newly
>>> >> >> > created users to this group.
>>> >> >> >
>>> >> >> > If possible generate a small text file about the results on the
>>> >> >> > script
>>> >> >> > ran.
>>> >> >> >
>>> >> >> > IS this possible?
>>> >> >> >
>>> >> >> > TIA
>>> >> >>
>>> >> >>
>>> >> >>
>>> >>
>>> >>
>>> >>
>>>
>>>
>>>

>
>



Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows Server > Active Directory


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Add users to Group via Script - [WP]"
Thread Thread Starter Forum Replies Last Post
Script to add existing AD users to a group tnai9 Active Directory 1 26-05-2011 12:34 AM
Script to add existing AD users to a group tnai9 Active Directory 5 28-12-2009 01:48 PM
copying users form one group to a new group Johan deheugden Active Directory 4 28-10-2009 06:05 PM
ADMT 3.0 Users Migration: Fix Users' Group Memberships stopped working Jason Windows Server Help 11 05-12-2008 01:14 PM
script to add multple users to local admin group on servers tdubb Windows Server Help 1 21-03-2008 06:16 AM


All times are GMT +5.5. The time now is 07:29 PM.