Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 1 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
add comment

Your Answer

 
discard

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.