How do I enable anonymous login in SharePoint Server 2010?
Or, in Powershell:
$wa = get-spwebapplication http://{url}
$zone = [Microsoft.SharePoint.Administration.SPUrlZone]::Extranet
$i = $wa.IisSettings[$zone]
$i.AllowAnonymous = $true
$wa.Update()
$wa.ProvisionGlobally()
$w = Get-SPWeb http://{url}
$w.AnonymousState = [Microsoft.SharePoint.SPWeb+AnonymousState]::On
$w.Update()
$l = $w.Lists["Comments"]
$l.AnonymousPermMask64 = {BasePermissions as appropriate}
-
Just to be safe, it is a good idea to use Start-SPAssignment / Stop-SPAssignment with disposable SharePoint objects: Start-SPAssignment -Global <NEWLINE> $w = Get-SPWeb http://{url} <NEWLINE> #more code here <NEWLINE> Stop-SPAssignment -Global – Anders Rask Jun 28 '10 at 13:18
-
When processing many SPWeb's, I agree. Most dev's that I teach find the SPAssignment model confusing, so I leave that out of snippets that I post. [Closing the PowerShell console will clean-up memory ;)] – Paul Schaeflein Jun 28 '10 at 16:12
-
Yeah thats what i ment with just to be safe. You never know where the code is going to run, and you never now when your IT pro will close that console again ;-) Global assignment collections is simple, but SemiGlobal can get confusing when you start piping it to Get-SPWeb :-) – Anders Rask Jun 28 '10 at 18:59
-
The AnonymousState enum is written as
[Microsoft.SharePoint.SPWeb+WebAnonymousState]::On
in 2013 – Eric Herlitz Oct 14 '14 at 9:56