-1

How do I give a user "full read" permissions to a web application with PowerShell?

The Script below assigns "full control" to a user on this web application with "full control" and "full read".

$w = Get-SPWebApplication -identity http://webapplication
$w.GrantAccessToProcessIdentity("Domain\SPUsername")

How do I remove "full control" and "full read" permissions using PowerShell to an user on a web application?

  • Hi, did my answere help you? If yes. pls mark it as the correct one. If not. Ask some more questions. – Sebastian Schütze Feb 10 '16 at 11:26
2

I think that this could be your solution:

Add a User or Group to the SPWebApplication User Policy for all Web Applications in the farm

The interesting code should be

Get-SPWebApplication http://sharepoint2010 | foreach { 
$webApp = $_ 
$policy = $webApp.Policies.Add($userOrGroup, $displayName) 
$policyRole = $webApp.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) 
$policy.PolicyRoleBindings.Add($policyRole) 
$webApp.Update() 

}

The critical part is the

[Microsoft.SharePoint.Administration.SPPolicyRoleType]

Enumeration.

SPPolicyRoleType enumeration

Hope that helps!

  • Hi how i use this code, is this powershell code? How to remove full control and full read permissions using powerhsell? – adilahmed Feb 7 '16 at 16:42
  • just remove (in the same script before adding) the user itself from the PolicyRoles and readd him with full read permission to that webapplication. You don't need to change that. And yes this is PowerShell! – Sebastian Schütze Feb 7 '16 at 19:33
  • hi if you can , please post script for how to remove full permissions and full read permissions ?? – adilahmed Feb 10 '16 at 15:15
  • what is the difference between GrantAccessToProcessIdentity(“Domain/User”)? and above powershell code? – adilahmed Feb 10 '16 at 15:26
  • this script for all web applications or only one web application ? – adilahmed Feb 10 '16 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.