Delete the user from the group using SharePoint 2010 web service in powershell

Steps Involved:

  1. Open SharePoint 2010 Management Shell by going to Start | All Programs | SharePoint | Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell (Run as Administrator).
  2. Run the following script.

Powershell Script:

 
## Delete the user from the group using SharePoint 2010 web service in powershell
$uri="http://serverName:10736/sites/ECT/_vti_bin/UserGroup.asmx?wsdl"
## $groupName is a string that contains group name from where the specified user has to be deleted
[
String]$groupName ="NewGroup1";
## $userLoginName is a string which contains the user name that has to be deleted from the specified group
[
String]$userLoginName="domainName\userName";
## Web Service Reference - http://Site/_vti_bin/UserGroup.asmx
$usergroupWebServiceReference = New-WebServiceProxy -Uri $uri -UseDefaultCredential
$usergroupWebServiceReference.RemoveUserFromGroup($groupName,$userLoginName)


Using the above script you will be able to delete the user from the specified group.

Ebook Download
View all
Learn
View all