Skip Ribbon Commands Skip to main content

SharePoint Happenings

Help (new window)
Sign In
Navigate Up
Get Microsoft Silverlight
Install Silverlight plugin for a richer experience...
Blog Home |  Freeware |  Speaking |  About me

Create a SharePoint Web Application Policy with Powershell



Bookmark and Share

Top Tech Links










Top SharePoint Administrator Links









Top SharePoint Developer Links













NOTE: This blog has been moved to http://blog.philwicklund.com. If you'd like assistance, leave a comment on the copied post in the new location (hint, use search on the right to find the post).


Below is a simple PowerShell script you can use to grant a user or AD group a Full Control policy on a web application. You could use this in scenarios where you're scripting your SharePoint installation, and you want to script your policies as well:

 

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$site = new-Object Microsoft.SharePoint.SPSite("http://your.sharepointsite.com")

$wa = $site.WebApplication

$userOrGroup = "philsdevdomain\somegroup"

$policy = $wa.Policies.Add($userOrGroup, $userOrGroup)

$policy.PolicyRoleBindings.Add($wa.PolicyRoles.GetSpecialRole(

[Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl))

$wa.Update()

$site.Dispose()