WebApplication policy
A web application is composed of an Internet Information Services (IIS) web site that acts as a logical container for the site collections that you create. Before you can create a site collection, you must create a web application.
A web application can contain multiple site collections. Managing permissions for multiple collections can be difficult, especially if some users or groups need permissions other than those that apply for the whole web application.
Permission policies provide a centralized way to configure and manage a set of permissions that applies to only a subset of users or groups in a web application.
Below piece of code gets the webapplication user policy details for all the webapplications in SharePoint farm.
- Function GetAllWebAppPolicy()
- {
- $Output = $scriptBase + "\" + "FarmWebAppPolicyDetails.csv";
- "WebAppURL" + "," + "UserName" + "," + "Permissions" | Out-File -Encoding Default -FilePath $Output;
- $empty = ""
- $webapplications = get-spwebapplication
- foreach($webapplication in $webapplications)
- {
- $webapplication.url + "," + $empty + "," + $empty | Out-File -Encoding Default -Append -FilePath $Output;
- write-host "Generating web policy report for the web aplication" $webapplication.url -fore magenta
- foreach($policy in $webapplication.policies)
- {
- write-host $policy.username -fore cyan
- $empty + "," + $policy.username + "," + $empty | Out-File -Encoding Default -Append -FilePath $Output;
- foreach($role in $policy.PolicyRoleBindings)
- {
- write-host $role.name -fore yellow
- $empty + "," + $empty + "," + $role.name | Out-File -Encoding Default -Append -FilePath $Output;
- }
- }
- }
- write-host "Web policy report generated" -fore green
- }

Vijay SPosted Apr 30, 2015, 3:14 AM
Good
Santhakumar MunuswamyPosted Apr 29, 2015, 3:14 PM
good