Steps Involved:
- Open SharePoint 2010 Management Shell by going to Start | All Programs | SharePoint | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell (Run as Administrator).
- Run the following script.
Powershell Script:
## Add user collections to the group using SharePoint 2010 web service in powershell $uri="http://serverName:10736/sites/ECT2/_vti_bin/UserGroup.asmx?wsdl" ## $groupName is a string that contains group name in which the user collections has to be added [String]$groupName ="Group1"; ## $userInfoXmlPath is a string which contains the Users.xml path ## Users.xml contains the information about the users that has to be added to the specified group mentioned in $groupName $userInfoXmlPath="D:\Users.xml" $xmlDocument = New-Object -TypeName System.Xml.XmlDocument $xmlDocument.Load($userInfoXmlPath) ## $userInfoXml is a System.Xml.XmlNode object that specifies one or more user information that has to be added to the specified group $userInfoXml = $xmlDocument.DocumentElement
## Web Service Reference - http://Site/_vti_bin/UserGroup.asmx $usergroupWebServiceReference = New-WebServiceProxy -Uri $uri -UseDefaultCredential $usergroupWebServiceReference.AddUserCollectionToGroup($groupName,$userInfoXml)
|