Поделиться через


Get-SPWeb : Access to this Web site has been blocked.

If you are using PowerShell to enumerate SPSite or SPWeb objects in your farm, you may have encountered an “Access to this Web site has been blocked” error message, similar to this example:

Get-SPWeb : Access to this Web site has been blocked.
Please contact the administrator to resolve this problem.
At line:1 char:61
+ Get-SPSite -Limit All | WHERE { !$_.ReadLocked } | Get-SPWeb <<<< -Limit All | % {
+ CategoryInfo : InvalidData: (Microsoft.Share....SPCmdletGetWeb:SPCmdletGetWeb) [Get-SPWeb], SPException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetWeb

The reason you are receiving this error message is that one (or more) of your site collections are Read Locked, which means you can’t interact with them via the SharePoint OM, even as an administrator.

If you want to enumerate all the SPWeb objects in the farm, skipping the sites that are set to ReadLocked, use the following PowerShell:

Get-SPSiteAdministration -Limit All | WHERE { !$_.ReadLocked } | Get-SPWeb -Limit All | % {

       # YOUR CODE GOES HERE

}