Update OnlyAllowMembersViewMembership setting of a Sharepoint group using Powershell
Hi, I want to change the Allow Only members to view group (Who can view the membership of the group?) setting of a sharepoint group. How can I achive that? In .Net object Model we have 'OnlyAllowMembersViewMembership' property for Sharepoint group. Is there any property like it in powershell? Thanks
June 23rd, 2011 9:53am

Hi RonakJ, Actually, we start to support PowerShell for SharePoint from SharePoint 2010. In SharePoint 2007, in order to use PowerShell to update properties of SharePoint, we need to involve the SharePoint object models from PowerShell as shown below: [System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”) [System.Reflection.Assembly]::Load(“Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”) $spsite=[Microsoft.SharePoint.SPSite](“http://localhost/sites/intranet“) $spweb = $spsite.openweb() $group = $spweb.Groups["SPGroupOnlyAllowMembers"] $group.OnlyAllowMembersViewMembership = $true $group.update() $spweb.update() If you have any more questions, please feel free to ask. Thanks, Jinchun ChenJinchun Chen Forum Support Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff AT microsoft.com(Please replace AT with @)
Free Windows Admin Tool Kit Click here and download it now
June 28th, 2011 9:13am

Hi RonakJ, Actually, we start to support PowerShell for SharePoint from SharePoint 2010. In SharePoint 2007, in order to use PowerShell to update properties of SharePoint, we need to involve the SharePoint object models from PowerShell as shown below: [System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”) [System.Reflection.Assembly]::Load(“Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”) $spsite=[Microsoft.SharePoint.SPSite](“http://localhost/sites/intranet“) $spweb = $spsite.openweb() $group = $spweb.Groups["SPGroupOnlyAllowMembers"] $group.OnlyAllowMembersViewMembership = $true $group.update() $spweb.update() If you have any more questions, please feel free to ask. Thanks, Jinchun ChenJinchun Chen Forum Support Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff AT microsoft.com(Please replace AT with @)
June 28th, 2011 9:13am

In Powershell script for Sharepoint 2010 Site I have written the following code: $newGroup = $spWeb.SiteGroups[$groupName] $newGroup.OnlyAllowMembersViewMembership = $false $newGroup.Update() $spWeb.Update()
Free Windows Admin Tool Kit Click here and download it now
June 29th, 2011 9:30am

Thanks Chen. Thats exactly I want
July 3rd, 2011 2:20am

In Powershell script for Sharepoint 2010 Site I have written the following code: $newGroup = $spWeb.SiteGroups[$groupName] $newGroup.OnlyAllowMembersViewMembership = $false $newGroup.Update() $spWeb.Update()
Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2011 2:24am

In Powershell script for Sharepoint 2010 Site I have written the following code: $newGroup = $spWeb.SiteGroups[$groupName] $newGroup.OnlyAllowMembersViewMembership = $false $newGroup.Update() $spWeb.Update()
July 3rd, 2011 2:24am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics