Get the role definition information using SharePoint 2010 web service in powershell

Navigate to the SharePoint site. Go to Site Actions, click on Site Settings. In the Users and Permissions section click on Site Permissions. In the ribbon interface , click on Permission Tools "Edit" tab. In the Manage group, click on Permission Levels button. You could be able to see all the role definitions or permission levels.

In this you will see how to get the information about the particular role definition 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:

 
 
## Get the role definition information using SharePoint 2010 web service in powershell
$uri="http://serverName:10736/sites/ECT2/_vti_bin/UserGroup.asmx?wsdl"
## $roleName is a string that contains the name of the role definition
[
String]$roleName ="Custom";


## Web Service Reference - http://Site/_vti_bin/UserGroup.asmx
$usergroupWebServiceReference = New-WebServiceProxy -Uri $uri -UseDefaultCredential
[
System.Xml.XmlNode]$xmlNode=$usergroupWebServiceReference.GetRoleInfo($roleName)

## Creates an RoleInfo.xml file in the D:\ which contains information about the specified role definition
$output = New-Object -TypeName System.IO.StreamWriter -ArgumentList "D:\RoleInfo.xml", $false
$output.WriteLine("<?xml version=""1.0"" encoding=""utf-8"" ?>")
$output.WriteLine($xmlNode.OuterXml)
$output.WriteLine()
$output.Dispose()


Result: RoleInfo.xml


result.jpg