PowerShell: How to Set Anonymous Access on Specific SharePoint Sites

In this article, I’ll show you how to set Anonymous Access settings on-site with a PowerShell script. We have the following requirements for the script:

1.       Allow users to input Site URL

2.       Check to see if the site has Unique permissions or not

  • If not, we will reset the broken inheritance first and then set anonymous access on it
  • If yes, we only set anonymous access on it

3.       When setting anonymous access, we need to identify the following statuses:

  • Enabled -lists and libraries
  • On – Entire website
  • Disabled – Self-explanatory

How does it work?

Download AnonymousSite.ps1 file to your server

Input the URL site and press Enter.

Go back to your site and check out the result.