.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Problems adding AD Security Group to SP Group using PowerShell

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :SharePoint

I am trying to create a powershell script that will enumerate SharePoint 2010 permissions and groups from a .csv file. The script needs to

1) Create the SharePoint groups
2) Add an owner
3) Add an active directory doman security group
4) Add a permission level to the SharePoint group.

However, I can't seem to add active directory groups to the SharePoint groups even though the groups exist in SharePoint, as they have been imported through the UPS synch.  This is the code I have been using:

param (


    [string] $createspgroups = "SPGroupssh.csv"



$web = Get-SPWeb http://myserver


ipcsv $createspgroups | foreach {

$owner = $web.AllUsers[$_.Owner];

$adgroupname = $web.AllUsers[$_.ADGroupName]; 

$GroupName =$_.GroupName; 

$web.SiteGroups.Add($GroupName,$owner, $adgroupname, $GroupName) 

$memberGrp = $web.SiteGroups[$GroupName] 

$web.AssociatedMemberGroup = $memberGrp 


$memberAssignment = New-Object Microsoft.SharePoint.SPRoleAssignment($memberGrp)   



View Complete Post

More Related Resource Links

Can't find AD security group while creating Audience rule


Hi guys,

I'm trying to create audience rule : all members of AD group. But when I try to choose a security group I need I can't find in search window. Though I see another groups. So in a whole the problem is I can't see all the AD groups but only some of them. It doesn't depends on on its type (global or local domain).

What could be a reason?

Need help with web.config security - Can't figure out where the security group is located in the ap



   We have sepeartate folder called Managers in one of our web apps. And there was a security build around that folder in a web config file as below

<?xml version="1.0"?>
        <allow roles="AllManagers"/>
        <deny users="*"/>

I couldn't figure out where this group located in the application. Usually all our groups are defined in Active directory but except this group. I am not sure if this is defined on the web server or some where in the app itself. Because in the process of figuring out I have changed it to <allow users="*"/> just to make sure if this is the group we are looking for and YES It is and I have access to it. So I need to find out where this is located and add myself as one of the users to this group.

Can any one help me with this mystery.

Thanks in advance,


Adding group header in the cascading dropdown

Hi,   I have a cascading drop down, and in one of the dropdown i want to add a group header.    i,e suppose if i list the names (of girls and boys) i want to group them in a dropdown say(Girls and Boys as header under them the names)   Girls aaa bbb ccc Boys ddd gggt   Can anybody please help me

Adding a footer to a pre-existing row group

Hi, I want to add a group footer to my report which includes the individual provider name for each page. I have already added a parent row group for details relating to each provider without specifying to include a footer to the row group. When I now add a footer using the insert footer path this places the footer below my row grouping, when I then add the provider field to the footer every page returns the first provider in the list. How do I include the footer to the grouping so ever footer relates to the individual provider type in the main body of the report? Thanks James

adding row group header after the fact

I am aware that when adding a row group, a prompt asks you if you want to add the header and footer.  On my report, all the groupings are already created and do not want to have to recreate them again;  how can I add just the row group header? I can't seem to find the option   Thanks!Javier Guillen

In a group calendar, can items be made visiable to all users by default without adding them as atten

Well the title says it all really. We have a functioning sp 2010 site, setup this weekend, that's working great so far.  Primarily its being used for the company manual and procedures (a wiki site).  Search is working well and so on. I added a calendar with the intention of showing key company activities, plus holiday information and who's out at meetings.  We're a small company and this is unlikely to get ridiculously except on exceptional days. As it stands, when i create an item (for example someone out for a weeks holiday) unless another user adds one of the 'attendees' of the holiday event to the calendar it doesn't show up.  If I add all users as attendees then they can all see it by default. However, if I show that our chairman is attending a meeting at a client, then I can't explicitly say that the chairman is an attendee because for everyone to see it, they have to be attendees as well. I nsoed around a little and thought target audiences might be the way to go.  I configured all users and manager relationships, compiled the audience (it shows the right number of users).  However, if I setup a meeting with the chairman as an attendee, and the whole company audience as the target audience, then people still can't see it. Back to square one. So, is there an actual answer to this?  A different type of calendar, a query that

Is there a way to obtain where in a sharepoint site a certain security group is used?

There is a sharepoint group that has been set up and is used throughout a single sharepoint occurance with many team sites and lists. It has orginated from AD and sent over to sharepoint with collection. The want to rename the group name. I have used it throughout the site. Is there a way to identify what sites and lists have been secured with this site so I do not have to go manually through site by site? Thanks, Angela

Create SharePoint Security Group populated by AD query

Is there any non-code way to create a SharePoint Security Group that is populated by an AD query? The "standard" way of getting the same "effect" is to create a group that contains an AD group but that does not allow members of a particular site to see who else is also a member of the site Any thoughts?

New Item Added to List/Library trigers Alert to non-AD Security Group

I am trying to implement an alert when a new item is added to a list. Idealy this alert would be sent to either a SharePoint Group or a AD Distribution Group. I do not have access/authroization to create security groups. The research I have found so far tells me that I can only add AD users and AD mail-enabled security groups through the alert GUI. My questions is first is this a valid finding? Second, if I create a custom workflow can I have the workflow triger on new item added and have it send a notification to the specified SharePoint/Distribution group? Thank you in advance for your assistance.  

Programatically determine windows security group name SQLServer2005MSSQLUser

When SQL Server 2005 is installed it creates a local group following this convention   SQLServer2005MSSQLUser$<computername>$<instancename>   When the machine is renamed the group name does not change.   Is there a way to programatically (.NET 2.0 or SQL query) determine the group name?May we all make money in the sequel.

Adding a group while inheriting permissions

Hi all, I was wondering if its possible to create a group that only exists within a subsite, while still inheriting permissions, For example, I have a subsite named Child that currently inherits permissions from its parent site Parent.  Is it possible to create an Owners group only within Child that allows people to make changes exclusively to Child while at the same time continuing to inherit permissions from Parent? Any help at all would be greatly appreciated! 

SP-Designer Workflow Task assigned to a Security Group Problem

Task assigned to a Security Group Should be Filter basic on Show items only when the this conditon is true: "Assign To is Equal to [Me]" This above condtion shows my task only , not all task. So How i ve to make following Condition in it. "Assign To(Security Group) Contains [Me](currnt loged user). Actually Problem is that workflow is assinging a task to a GROUP( having a lot sharpeoint users) , if i m the current user(exists in that group) then i shud get the my task only ,which is assigned to me only , nothing else user's task. So pls help me. Thanks in Advance.Regards- Sharad

Adding existing user to existing group - Unknown error (0x80005000)


I am getting an unknown error 0x80005000.  Please help!

I am using impersonation of an admin account. Here's what I have in my web.config:

<identity impersonate="true" userName="mydomain\user" password="pwd"/>

<authentication mode="Windows" />


Here's my code:

Private Sub Page_Load(ByVal sender As System.Object, <

Determine if User is in Security Group


 this is what I need to use.

I want to determine if the current user (Windows ID) is in a specific Security Group.  If they are, then certain things will happen on certain forms of the website that I am working on.

I have tried the following code, but I am not getting any results.


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim user As WindowsIdentity
        user = WindowsIdentity.GetCurrent()
        Groups(user.Name, True)
End Sub

Public Function Groups(ByVal userDn As String, ByVal recursive As Boolean) As ArrayList
        Dim groupMemberships As New ArrayList()
        Return AttributeValuesMultiString("memberOf", userDn, groupMemberships, recursive)
    End Function

    Public Function AttributeValuesMultiString(ByVal attributeName As String, ByVal objectDn As String, ByVal valuesCollection As ArrayList, ByVal recursive As Boolean) As ArrayList
        Dim ent As New DirectoryEntry(objectDn)
        Dim ValueCollection As PropertyValueCollection = ent.Properties(attributeName)
        Dim en As IEnumerator = ValueCollection.GetEnumerator()

        While en.MoveNext()
            If en.Current IsNot Nothing Then
                If Not valuesCollection.Contains(en.Current.ToString()) Then

Show users based on ad-security group or OU


Will it somehow be possible to show members of a AD group ?

We have some superusers, and they all have the ad-group: super_users.

Can i show all members somehow ?

Maybe by a search flag, so it is just a link to a search result ?

Jakob Olsen

Getting "A domain group is missing for one or more services" error when adding new node to existing


Hey all,

Current configuration:

2-node sql 2005 cluster

windows 2003 enterprise R2 w/ sp2 x64

sql 2005 enterprise x64 SP3


In the process of adding a third node into the existing 2-node cluster, we received the

"A domain group is missing for one or more services.  To install SQL 2005 as a failover cluster, domain groups must be specified for all the clustered services bing installed. To proceed, enter the missiong domain group information." 

The existing cluster functions properly and has been running w/o problems for a long while now.  An AD Global Group was created to support the cluster back when the cluster was initially created.


I found different suggestions from people online about this issue, any where from adding registry keys to take trailing blank space from sql resource group name, but none works. 


Any ideas?


Thank you in advance for any assistance.



How to add AD Security group to Audience of Web Part?


We have RSS Viewer webpart in the SharePoint Server 2010 Enterprise based portal.

I would like set audience, which includes AD security group "Management".
How to do it?

So far I have been able to use SharePoint group in auding, but
Modify->Advance->Target Audience->Browser->Distibution/Security Group did not find any AD groups.

What does the Distibution/Security Group actually mean? How to add groups there?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend