You can associate Custom Groups in SharePoint 2010 as Visitor Group, Member Group or Owner Group. This is a scenario that you might encounter if you’re creating Web sites using code. To associate custom-created groups, you can use the spWeb property bag directly as shown below. First, you can retrieve a specific Web site:
PS > $spWeb = Get-SPWeb “http://SP01.powershell.nu”
Next, get the group that you want to associate:
PS > $group = $spWeb.SiteGroups[“My New Group”]
Try this if you want to associate the Group as a Owner Group:
PS > $spWeb.Properties["vti_associateownergroup"] = $group.Id
If you want to associate the Group as a Member Group:
PS > $spWeb.Properties["vti_associatemembergroup"] = $group.ID
If you want to associate the Group as a Visitor Group:
PS > $spWeb.Properties["vti_associatevisitorgroup"] = $group.ID
When you’re done, you can use the Update() method to commit the changes:
PS > $spWeb.Properties.Update()
PS > $spWeb.Dispose()
ReTweet this Tip!
Posted
Sep 05 2011, 06:00 AM
by
sos