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 have an FBA site and I need to add "all authenticated users" to a group using PowerShell. How can I do that?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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
                }
                else
                {
                                $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]
                                $roleAssignment.RoleDefinitionBindings.Add($roleDefinition)
                                $web.RoleAssignments.Add($roleAssignment)
                                $web.Update()
                                Write-Host "Group $GroupName created successfully" -foregroundcolor Green
                }
                $user = "c:0(.s|true"
                $web.SiteGroups[$GroupName].AddUser($user, "", "","")               
                $web.Dispose()
share|improve this answer
    
I found this suggestion here: sharemuch.com/2011/12/06/… was wondering how to do it in powershell. –  Emad 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

 
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.