I have an FBA site and I need to add "all authenticated users" to a group using PowerShell. How can I do that?


You cannot add All Authenticated Users in FBA site. You can do it in Windows sites only. There is however a work around as suggested in this link by creating a role in the directory service, add all existing users to it. http://blogs.msdn.com/b/bgeoffro/archive/2008/04/09/adding-an-all-authenticated-users-feature-to-forms-based-authentication.aspx

I wonder whether the link provided by you will be of any help. But here is the Powershell equivalent of that code:

$Url = "http://sitename"
                $GroupName = "group name"
                $PermissionLevel = "Read"
                $Description = "group description"              
                $web = Get-SPWeb -Identity $Url
                if ($web.SiteGroups[$GroupName] -ne $null)
                                Write-Host "Group $GroupName already exists!" -foregroundcolor Red
                                $web.SiteGroups.Add($GroupName, $web.Site.Owner, $web.Site.Owner, $Description)
                                $group = $web.SiteGroups[$GroupName]
                                $roleAssignment = new-object Microsoft.SharePoint.SPRoleAssignment($group)
                                $roleDefinition = $web.Site.RootWeb.RoleDefinitions[$PermissionLevel]
                                Write-Host "Group $GroupName created successfully" -foregroundcolor Green
                $user = "c:0(.s|true"
                $web.SiteGroups[$GroupName].AddUser($user, "", "","")               
  • I found this suggestion here: sharemuch.com/2011/12/06/… was wondering how to do it in powershell. – Emad Gabriel Jan 20 '13 at 2:42
  • 2
    It's not possible, like Nadeem correctly answered earlier (+1 !) To solve your issue, you can add all required FBA roles to the relevant SP built-in group (or create a new one for the case). Since all user should belong to at least one group, you'll add them all in the end. (and you won't need to add a new "AllUsers" group in your FBA Role / Membership. The powershell displayed above will put you on road provided that you have in hand all role to add. – Francois Verbeeck Jan 20 '13 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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