Remove SharePoint Web Application Policy using PowerShell

Requirement: Remove Web Application Policy using PowerShell.

How to remove a web application Policy in SharePoint?

In SharePoint, user policies can be applied at the web application level to control access to resources for specific users or groups. PowerShell and Central Admin provide an easier way to manage user policies for web applications in SharePoint.

To remove a user or group from SharePoint web application Policy, follow these steps:

  1. Login to SharePoint Central Administration Site.
  2. Application Management >> Manage Web Applications.
  3. Select the appropriate web application from the list >> Click on the “User Policy” button from the ribbon. 
    delete web application policy in sharepoint
  4. Now, from the “Policy for Web Application” page, Select the user or group to remove and click the “Delete Selected Users” link.
  5. Confirm the prompt once to remove select accounts from the web application Policy.
    remove web application policy using powershell

PowerShell to Remove a Web Application Policy in SharePoint:

You can use PowerShell to manage your SharePoint web application policies. Let’s see how to remove a web application policy using PowerShell.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

Function Remove-WebAppPolicy($WebAppURL, $Account)
    Try {
        Write-host "Removing Account '$Account' from the Web Application '$WebAppURL'..." -f yellow

        #Get the web application
        $WebApp = Get-SPWebApplication $WebAppURL -EA SilentlyContinue

        #Check if web application Exists
        if ($WebApp -eq $null)
            $ErrorMsg = "Web Application " + $WebAppURL + " not found!"
            Throw $ErrorMsg
        #PowerShell to delete a web application policy in SharePoint
        $Policy = $webApp.Policies.Remove($Account)

        Write-host "Web Application Policy Removed Successfully! " -f green

 Catch {
        Write-host -f Red "Error Deleting Web Application Policy:" $_.Exception.Message


#Call the function to remove web application Policy
Remove-WebAppPolicy -WebAppURL "" -Account "i:0#.w|crescent\salaudeen"

By following the steps outlined in this article, you can easily remove a user or group from the user policy of a web application in SharePoint using PowerShell. To Add a web application policy in SharePoint, use this PowerShell script: SharePoint PowerShell to Add Web Application User Policy

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *