Bulk load users in a group


Tutte le risposte

  • Hi ChitraSaha,

    Usually you will have groups already defined in AD and have included them using SharePoint's User Profile synchronization Service. It helps if you are targeting multiple groups to have them added to one group for easier maintenance. 

    For more information see:

    Kind Regards, Justin Nash

    martedì 13 marzo 2012 22:07
  • Hi ChitraSaha.

    What you preferably do is add all the users to a AD group, then add that AD group to a SharePoint group. That way, you can administer the users access in AD and SharePoint.
    But, if this is not an option, then you could use Powershell to add all the users. My good friend Niklas Goude tells you how:

    Configure it to read all users from a csv file or xml file and it will work. Remember though, there is a limitation on the number of users a SharePoint group can hold...better to use AD.


    Thomas Balkeståhl - Technical Specialist - SharePoint -
    Download the SharePoint Branding Project here

    martedì 13 marzo 2012 23:07
  • Hello!

    Following the link


    2.$SPSite = New-Object Microsoft.SharePoint.SPSite("http://wss"); $OpenWeb = $SpSite.

    3. $User | ForEach-Object {

    But I get the error

    Missing ')' in method call.
    At line:4 char:15
    +         $_.test <<<< @sss.yyy,
        + CategoryInfo          : ParserError: (CloseParenToken:TokenId) [], Paren
        + FullyQualifiedErrorId : MissingEndParenthesisInMethodCall

    Please advice
    mercoledì 14 marzo 2012 14:28
  • Hi

    I tried it and it works for me. Perhaps just a copy-paste-error? Try this (replace with your site and groupname)


    $SPSite = New-Object Microsoft.SharePoint.SPSite("http://mysharepointsite"); $OpenWeb = $SpSite.OpenWeb(); $TheNewGroup = $OpenWeb.SiteGroups | Where-Object {$_.Name -match "myGroupName"}; $OpenWeb.Dispose(); $SPSite.Dispose()

    $SPSite = New-Object Microsoft.SharePoint.SPSite("http://mysharepointsite"); $OpenWeb = $SpSite.OpenWeb(); $User = $OpenWeb.Users | Select Name, Email, LoginName; $OpenWeb.Dispose(); $SPSite.Dispose()

    $User | ForEach-Object {$TheNewGroup.AddUser($_.LoginName,$_.Email,$_.Name,"")}

    venerdì 16 marzo 2012 12:07
  • After executing the following statement:

    $SPSite = New-Object Microsoft.SharePoint.SPSite("http://test"); $OpenWeb = $SpSite.OpenWeb(); $User = $OpenWeb.Users | Select Name, Email, LoginName; $OpenWeb.Dispose(); $SPSite.Dispose()


    New-Object : A positional parameter cannot be found that accepts argument 'Stud
    ent Life'.
    At line:1 char:21
    + $SPSite = New-Object <<<<  Microsoft.SharePoint.SPSite("http://test")$OpenWeb = $SpSite.OpenWeb(); $User = $OpenWeb.Users | Select Name, Emai
    l, LoginName; $OpenWeb.Dispose(); $SPSite.Dispose()
        + CategoryInfo          : InvalidArgument: (:) [New-Object], ParameterBind
        + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell

    Please advice

    venerdì 16 marzo 2012 16:15
  • I think I got it!
    venerdì 16 marzo 2012 16:25
  • Hello!

    Cannot get the following script working:

    $User | ForEach-Object{$TheNewGroup.AddUser($_.test,$,$_.test lastname,"")}

    PS C:\Scripts> .\user.ps1
    Missing ')' in method call.
    At C:\Scripts\user.ps1:1 char:58
    + $User | ForEach-Object{$TheNewGroup.AddUser($_.test,$_.test <<<<,$_.test LastName,"")}
        + CategoryInfo          : ParserError: (CloseParenToken:TokenId) [], Parse
        + FullyQualifiedErrorId : MissingEndParenthesisInMethodCall

    venerdì 16 marzo 2012 19:33
  • Hi.

    If you are trying to add the string '' to the $_.test then I think that you need to do it better.

    $User | ForEach-Object{$TheNewGroup.AddUser($_.test,$_.test + "",$_.test lastname,"")}


    $User | ForEach-Object{
    $email = $_.test+"";
    $TheNewGroup.AddUser($_.test,$email,$_.test lastname,"")


    Thomas Balkeståhl - Technical Specialist - SharePoint -
    Download the SharePoint Branding Project here

    venerdì 16 marzo 2012 20:42