SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to use the Set-SPWebApplication to turn on anonymous access in SharePoint2010 web application using PowerShell, however it give me the following error (see the screenshot here):

Add SharePoint snappin

Add-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$app = Get-SPWebApplication http://ybbest/ Set-SPwebApplication -Identity $app -AllowAnonymousAccess:$True -Zone Default

Set-SPWebApplication : A parameter cannot be found that matches parameter name 'AllowAnonymousAccess'. At C:\Users\Administrator\AppData\Local\Temp\1\5fa9c881-a962-44fa-8edc-4b5e4c4bb8d1.ps1:6 char:59 + Set-SPwebApplication -Identity $app -AllowAnonymousAccess: <<<< $True -Zone Default + CategoryInfo : InvalidArgument: (:) [Set-SPWebApplication], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.SharePoint.PowerShell.SPCmdletSetWebApplication

share|improve this question
up vote 2 down vote accepted

PowerShell errors can be deceptive, but for once this one is quite clear: That switch parameter only exists for new-SPWebApplication not set-SPWebApplication hence the error.

You can set it afterwards too, but then you need to get an instance of the SPWindowsAuthenticationProvider

Remember to also set AnonymousState for each SPSite that must run anonymously.

More info and script samples here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.